Package-level declarations
Core IO primitives.
Core IO primitives.
Core IO primitives.
Core IO primitives.
Core IO primitives.
Core IO primitives.
Types
Marks declarations that should be used carefully and in some cases, may cause data corruption or loss.
Signals that the end of the file or stream was reached unexpectedly during an input operation.
Marks declarations that are internal in IO API. These declarations may change or be removed without notice, and not intended for public use. Incorrect of declarations marked as internal may cause data corruption or loss.
Signals about a general issue occurred during I/O operation.
Receives a stream of bytes. RawSink is a base interface for kotlinx-io
data receivers.
Supplies a stream of bytes. RawSource is a base interface for kotlinx-io
data suppliers.
Functions
Returns a new ByteChannel instance representing this buffer.
Returns WritableByteChannel backed by this sink. Closing the channel will also close the sink.
Returns ReadableByteChannel backed by this source. Closing the source will close the source.
Returns an input stream that reads from this source. Closing the stream will also close this source.
Returns an input stream that reads from this source. Closing the stream will also close this source.
Returns an output stream that writes to this sink. Closing the stream will also close this sink.
Returns an output stream that writes to this sink. Closing the stream will also close this sink.
Returns a new sink that buffers writes to the sink. The returned sink will batch writes to the sink. Use this wherever you write to a sink to get ergonomic and efficient access to data.
Returns a new source that buffers reads from the source. The returned source will perform bulk reads into its in-memory buffer. Use this wherever you read a source to get ergonomic and efficient access to data.
Copy bytes from this buffer's subrange, starting at startIndex and ending at endIndex, to out. This method does not consume data from the buffer.
Returns a sink that discards all data written to it.
Returns the index of the first match for byteString in the source at or after startIndex. This expands the source's buffer as necessary until byteString is found. This reads an unbounded number of bytes into the buffer. Returns -1
if the stream is exhausted before the requested bytes are found.
Returns an index of byte first occurrence in the range of startIndex to endIndex, or -1
when the range doesn't contain byte.
Writes up to ByteBuffer.remaining bytes from this buffer to the sink. Return the number of bytes written.
Reads at most ByteBuffer.remaining bytes from this source into sink and returns the number of bytes read.
Removes all bytes from this source and returns them as a byte array.
Removes byteCount bytes from this source and returns them as a byte array.
Consumes all bytes from this source and wraps it into a byte string.
Consumes exactly byteCount bytes from this source and wraps it into a byte string.
Reads a long from this source in signed decimal form (i.e., as a string in base 10 with optional leading -
).
Removes eight bytes from this source and returns a floating point number with type Double composed of it according to the big-endian order.
Removes eight bytes from this source and returns a floating point number with type Double composed of it according to the little-endian order.
Removes four bytes from this source and returns a floating point number with type Float composed of it according to the little-endian order.
Reads a long form this source in hexadecimal form (i.e., as a string in base 16).
Removes and returns UTF-8 encoded characters up to but not including the next line break, throwing EOFException if a line break was not encountered. A line break is either "\n"
or "\r\n"
; these characters are not included in the result.
Removes eight bytes from this source and returns a long integer composed of it according to the little-endian order.
Removes two bytes from this source and returns a short integer composed of it according to the little-endian order.
Removes all bytes from this buffer, decodes them as UTF-8, and returns the string.
Removes all bytes from this source, decodes them as UTF-8, and returns the string.
Removes byteCount bytes from this source, decodes them as UTF-8, and returns the string.
Removes exactly endIndex - startIndex
bytes from this source and copies them into sink subrange starting at startIndex and ending at endIndex.
Removes four bytes from this source and returns an unsigned integer composed of it according to the little-endian order.
Removes eight bytes from this source and returns an unsigned long integer composed of it according to the little-endian order.
Removes two bytes from this source and returns an unsigned short integer composed of it according to the big-endian order.
Removes two bytes from this source and returns an unsigned short integer composed of it according to the little-endian order.
Creates a byte string containing a copy of all the data from this buffer.
Return true
if the next byte to be consumed from this source is equal to byte. Otherwise, return false
as well as when the source is exhausted.
Reads all data from source into this buffer.
Writes subsequence of data from byteString starting at startIndex and ending at endIndex into a sink.
Writes data from the source into this sink and returns the number of bytes written.
Writes long to this sink in signed decimal form (i.e., as a string in base 10).
Writes long to this sink in hexadecimal form (i.e., as a string in base 16).
Writes four bytes containing int, in the little-endian order, to this sink.
Writes eight bytes containing long, in the little-endian order, to this sink.
Writes two bytes containing short, in the little-endian order, to this sink.
Encodes the characters at startIndex up to endIndex from string in UTF-8 and writes it to this sink.
Encodes substring of string starting at startIndex and ending at endIndex using charset and writes into this sink.
Provides direct access to the sink's internal buffer and hints its emit before exit.
Writes am unsigned byte to this sink.
Writes four bytes containing int, in the little-endian order, to this sink.
Writes eight bytes containing long, in the big-endian order, to this sink.
Writes eight bytes containing long, in the little-endian order, to this sink.
Writes two bytes containing short, in the big-endian order, to this sink.
Writes two bytes containing short, in the little-endian order, to this sink.