Skip to content

//okio/okio/ByteString

ByteString

[js, native] open class ByteString : Comparable
[jvm] open class ByteString : Serializable, Comparable

Types

Name Summary
Companion [js, jvm, native]
Content
[js, jvm, native]
object Companion


Functions

Name Summary
asByteBuffer [jvm]
Brief description
Returns a ByteBuffer view of the bytes in this ByteString.
Content
open fun asByteBuffer(): ByteBuffer


base64 [js, jvm, native]
Content
[js, jvm, native]
open fun base64(): String


base64Url [js, jvm, native]
Content
[js, jvm, native]
open fun base64Url(): String


compareTo [js, jvm, native]
Content
[js, jvm, native]
open operator override fun compareTo(other: ByteString):


endsWith [js, jvm, native]
Content
[js, jvm, native]
fun endsWith(suffix: ByteString):
[js, jvm, native]
fun endsWith(suffix: ByteArray):


equals [js, jvm, native]
Content
[js, jvm, native]
open operator override fun equals(other: Any?):


get [js, jvm, native]
Content
[js, native]
operator fun get(index: Int): Byte
[jvm]
@JvmName(name = “getByte”)

operator fun get(index: Int): Byte


hashCode [js, jvm, native]
Content
[js, jvm, native]
open override fun hashCode():


hex [js, jvm, native]
Content
[js, jvm, native]
open fun hex(): String


hmacSha1 [jvm]
Brief description
Returns the 160-bit SHA-1 HMAC of this byte string.
Content
open fun hmacSha1(key: ByteString): ByteString


hmacSha256 [jvm]
Brief description
Returns the 256-bit SHA-256 HMAC of this byte string.
Content
open fun hmacSha256(key: ByteString): ByteString


hmacSha512 [jvm]
Brief description
Returns the 512-bit SHA-512 HMAC of this byte string.
Content
open fun hmacSha512(key: ByteString): ByteString


indexOf [js, jvm, native]
Content
[js, native]
fun indexOf(other: ByteString, fromIndex: Int):
[jvm]
@JvmOverloads()

fun indexOf(other: ByteString, fromIndex: Int):
[js, native]
open fun indexOf(other: ByteArray, fromIndex: Int):
[jvm]
@JvmOverloads()

open fun indexOf(other: ByteArray, fromIndex: Int):


lastIndexOf [js, jvm, native]
Content
[js, native]
fun lastIndexOf(other: ByteString, fromIndex: Int):
[jvm]
@JvmOverloads()

fun lastIndexOf(other: ByteString, fromIndex: Int):
[js, native]
open fun lastIndexOf(other: ByteArray, fromIndex: Int):
[jvm]
@JvmOverloads()

open fun lastIndexOf(other: ByteArray, fromIndex: Int):


md5 [jvm]
Brief description
Returns the 128-bit MD5 hash of this byte string.
Content
open fun md5(): ByteString


rangeEquals [js, jvm, native]
Content
[js, jvm, native]
open fun rangeEquals(offset: Int, other: ByteString, otherOffset: Int, byteCount: Int): Boolean
[js, jvm, native]
open fun rangeEquals(offset: Int, other: ByteArray, otherOffset: Int, byteCount: Int): Boolean


sha1 [jvm]
Brief description
Returns the 160-bit SHA-1 hash of this byte string.
Content
open fun sha1(): ByteString


sha256 [jvm]
Brief description
Returns the 256-bit SHA-256 hash of this byte string.
Content
open fun sha256(): ByteString


sha512 [jvm]
Brief description
Returns the 512-bit SHA-512 hash of this byte string.
Content
open fun sha512(): ByteString


startsWith [js, jvm, native]
Content
[js, jvm, native]
fun startsWith(prefix: ByteString):
[js, jvm, native]
fun startsWith(prefix: ByteArray):


string [jvm]
Brief description
Constructs a new String by decoding the bytes using charset.
Content
open fun string(charset: Charset): String


substring [js, jvm, native]
Content
[js, native]
open fun substring(beginIndex: Int, endIndex: Int): ByteString
[jvm]
@JvmOverloads()

open fun substring(beginIndex: Int, endIndex: Int): ByteString


toAsciiLowercase [js, jvm, native]
Content
[js, jvm, native]
open fun toAsciiLowercase(): ByteString


toAsciiUppercase [js, jvm, native]
Content
[js, jvm, native]
open fun toAsciiUppercase(): ByteString


toByteArray [js, jvm, native]
Content
[js, jvm, native]
open fun toByteArray():


toString [js, native]
Brief description
Returns a human-readable string that describes the contents of this byte string. Typically this is a string like [text=Hello] or [hex=0000ffff].
Content
[js, native]
open override fun toString():


[jvm]
Brief description

Content
open override fun toString():


utf8 [js, jvm, native]
Content
[js, jvm, native]
open fun utf8(): String


write [jvm]
Brief description
Writes the contents of this byte string to out.
Content
open fun write(out: OutputStream)


Properties

Name Summary
size [js, jvm, native] val size: