Skip to content

//okio/okio/Buffer

Buffer

[jvm] class Buffer : BufferedSource, BufferedSink, Cloneable, ByteChannel

Types

Name Summary
UnsafeCursor [jvm]
Content
class UnsafeCursor : Closeable


Functions

Name Summary
buffer [jvm]
Brief description
Returns this source’s internal buffer.
Content
open override fun buffer(): Buffer


clear [jvm]
Content
fun clear():


clone [jvm]
Brief description
Returns a deep copy of this buffer.
Content
open override fun clone(): Buffer


close [jvm]
Content
open override fun close()


completeSegmentByteCount [jvm]
Content
fun completeSegmentByteCount(): Long


copy [jvm]
Content
fun copy(): Buffer


copyTo [jvm]
Brief description
Copy byteCount bytes from this, starting at offset, to out.
Content
@JvmOverloads()

fun copyTo(out: OutputStream, offset: Long, byteCount: Long): Buffer


[jvm]
Content
fun copyTo(out: Buffer, offset: Long, byteCount: Long): Buffer
fun copyTo(out: Buffer, offset: Long): Buffer


emit [jvm]
Content
open override fun emit(): Buffer


emitCompleteSegments [jvm]
Content
open override fun emitCompleteSegments(): Buffer


equals [jvm]
Content
open operator override fun equals(other: Any?): Boolean


exhausted [jvm]
Content
open override fun exhausted(): Boolean


flush [jvm]
Content
open override fun flush()


get [jvm]
Content
@JvmName(name = “getByte”)

operator fun get(pos: Long): Byte


hashCode [jvm]
Content
open override fun hashCode(): Int


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


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


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


indexOf [jvm]
Content
open override fun indexOf(b: Byte): Long
open override fun indexOf(b: Byte, fromIndex: Long, toIndex: Long): Long
open override fun indexOf(bytes: ByteString): Long
open override fun indexOf(bytes: ByteString, fromIndex: Long): Long


[jvm]
Brief description
Returns the index of b in this at or beyond fromIndex, or -1 if this buffer does not contain b in that range.
Content
open override fun indexOf(b: Byte, fromIndex: Long): Long


indexOfElement [jvm]
Content
open override fun indexOfElement(targetBytes: ByteString): Long
open override fun indexOfElement(targetBytes: ByteString, fromIndex: Long): Long


inputStream [jvm]
Brief description
Returns an input stream that reads from this source.
Content
open override fun inputStream(): InputStream


isOpen [jvm]
Content
open override fun isOpen(): Boolean


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


outputStream [jvm]
Brief description
Returns an output stream that writes to this sink.
Content
open override fun outputStream(): OutputStream


peek [jvm]
Content
open override fun peek(): BufferedSource


rangeEquals [jvm]
Content
open override fun rangeEquals(offset: Long, bytes: ByteString): Boolean
open override fun rangeEquals(offset: Long, bytes: ByteString, bytesOffset: Int, byteCount: Int): Boolean


read [jvm]
Content
open override fun read(sink: ByteArray):
open override fun read(sink: ByteArray, offset: Int, byteCount: Int): Int
open override fun read(sink: ByteBuffer): Int
open override fun read(sink: Buffer, byteCount: Long): Long


readAll [jvm]
Content
open override fun readAll(sink: Sink): Long


readAndWriteUnsafe [jvm]
Content
@JvmOverloads()

fun readAndWriteUnsafe(unsafeCursor: Buffer.UnsafeCursor): Buffer.UnsafeCursor


readByte [jvm]
Content
open override fun readByte(): Byte


readByteArray [jvm]
Content
open override fun readByteArray():
open override fun readByteArray(byteCount: Long): ByteArray


readByteString [jvm]
Content
open override fun readByteString(): ByteString
open override fun readByteString(byteCount: Long):


readDecimalLong [jvm]
Content
open override fun readDecimalLong(): Long


readFrom [jvm]
Brief description
Read and exhaust bytes from input into this.
Content
fun readFrom(input: InputStream): Buffer


[jvm]
Brief description
Read byteCount bytes from input into this.
Content
fun readFrom(input: InputStream, byteCount: Long): Buffer


readFully [jvm]
Content
open override fun readFully(sink: Buffer, byteCount: Long)
open override fun readFully(sink: ByteArray):


readHexadecimalUnsignedLong [jvm]
Content
open override fun readHexadecimalUnsignedLong(): Long


readInt [jvm]
Content
open override fun readInt(): Int


readIntLe [jvm]
Content
open override fun readIntLe():


readLong [jvm]
Content
open override fun readLong(): Long


readLongLe [jvm]
Content
open override fun readLongLe():


readShort [jvm]
Content
open override fun readShort(): Short


readShortLe [jvm]
Content
open override fun readShortLe():


readString [jvm]
Brief description
Removes all bytes from this, decodes them as charset, and returns the string.
Content
open override fun readString(charset: Charset): String


[jvm]
Brief description
Removes byteCount bytes from this, decodes them as charset, and returns the string.
Content
open override fun readString(byteCount: Long, charset: Charset): String


readUnsafe [jvm]
Content
@JvmOverloads()

fun readUnsafe(unsafeCursor: Buffer.UnsafeCursor): Buffer.UnsafeCursor


readUtf8 [jvm]
Content
open override fun readUtf8(): String
open override fun readUtf8(byteCount: Long): String


readUtf8CodePoint [jvm]
Content
open override fun readUtf8CodePoint(): Int


readUtf8Line [jvm]
Content
open override fun readUtf8Line(): String?


readUtf8LineStrict [jvm]
Content
open override fun readUtf8LineStrict(): String
open override fun readUtf8LineStrict(limit: Long): String


request [jvm]
Content
open override fun request(byteCount: Long): Boolean


require [jvm]
Content
open override fun require(byteCount: Long)


select [jvm]
Content
open override fun select(options: ): Int


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


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


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


skip [jvm]
Content
open override fun skip(byteCount: Long):


snapshot [jvm]
Content
fun snapshot(): ByteString
fun snapshot(byteCount: Int): ByteString


timeout [jvm]
Content
open override fun timeout(): Timeout


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


write [jvm]
Content
open override fun write(byteString: ByteString): Buffer
open override fun write(byteString: ByteString, offset: Int, byteCount: Int):
open override fun write(source: ByteArray): Buffer
open override fun write(source: ByteArray, offset: Int, byteCount: Int): Buffer
open override fun write(source: ByteBuffer): Int
open override fun write(source: Source, byteCount: Long): Buffer
open override fun write(source: Buffer, byteCount: Long)


writeAll [jvm]
Content
open override fun writeAll(source: Source): Long


writeByte [jvm]
Content
open override fun writeByte(b: Int): Buffer


writeDecimalLong [jvm]
Content
open override fun writeDecimalLong(v: Long): Buffer


writeHexadecimalUnsignedLong [jvm]
Content
open override fun writeHexadecimalUnsignedLong(v: Long): Buffer


writeInt [jvm]
Content
open override fun writeInt(i: Int): Buffer


writeIntLe [jvm]
Content
open override fun writeIntLe(i: Int): Buffer


writeLong [jvm]
Content
open override fun writeLong(v: Long): Buffer


writeLongLe [jvm]
Content
open override fun writeLongLe(v: Long): Buffer


writeShort [jvm]
Content
open override fun writeShort(s: Int): Buffer


writeShortLe [jvm]
Content
open override fun writeShortLe(s: Int): Buffer


writeString [jvm]
Content
open override fun writeString(string: String, charset: Charset): Buffer
open override fun writeString(string: String, beginIndex: Int, endIndex: Int, charset: Charset): Buffer


writeTo [jvm]
Brief description
Write byteCount bytes from this to out.
Content
@JvmOverloads()

fun writeTo(out: OutputStream, byteCount: Long): Buffer


writeUtf8 [jvm]
Content
open override fun writeUtf8(string: String): Buffer
open override fun writeUtf8(string: String, beginIndex: Int, endIndex: Int): Buffer


writeUtf8CodePoint [jvm]
Content
open override fun writeUtf8CodePoint(codePoint: Int): Buffer


Properties

Name Summary
buffer [jvm] open override val buffer: Buffer
size [jvm] var size: Long