SdkBuffer
A collection of bytes in memory. Moving data from one buffer to another is fast.
Thread Safety Buffer is NOT thread safe and should not be shared between threads without external synchronization.
Properties
Functions
Writes all buffered data to the underlying sink. Like flush, but weaker (ensures data is pushed to the underlying sink but not necessarily all the way down the chain like flush does). Call before this sink goes out of scope to ensure any buffered data eventually gets to its final destination
Writes all buffered data to the underlying sink. Like flush, but weaker (ensures data is pushed to the underlying sink but not necessarily all the way down the chain like flush does). Call before this sink goes out of scope to ensure any buffered data eventually gets to its final destination
Returns true if there are no more bytes in this source. This will block until there are bytes to read or the source is definitely exhausted.
Get an input stream that reads from this source
Return an output stream that writes to this sink
Returns a new SdkBufferedSource that can read data from this source without consuming it. The returned source becomes invalid once this source is next read or closed.
Returns a new SdkBufferedSource that can read data from this source without consuming it. The returned source becomes invalid once this source is next read or closed.
Reads all bytes from this and appends them to sink. Returns the total number of bytes written which will be 0 if this source is exhausted.
Read four bytes from this source and returns a little-endian long.
Read eight bytes in little-endian order from this source and returns them as a long.
Read two bytes from this source and returns it as a little-endian short.
Read two bytes in little-endian order from this source and returns them as a short.
Reads all bytes from this source, decodes them as UTF-8, and returns the string.
Reads byteCount bytes from this source, decodes them as UTF-8, and returns the string.
Returns true when the buffer contains at least byteCount bytes. False if the source is exhausted before the requested number of bytes could be read
Returns when the buffer contains at least byteCount bytes or throws EOFException if the source is exhausted before the requested number of bytes could be read
Returns when the buffer contains at least byteCount bytes or throws EOFException if the source is exhausted before the requested number of bytes could be read
Discards byteCount bytes from this source. Throws IOException if source is exhausted before byteCount bytes can be discarded.
Discards byteCount bytes from this source. Throws IOException if source is exhausted before byteCount bytes can be discarded.
Write string as UTF-8 encoded bytes to this sink starting at start index up to endExclusive index.
Inherited functions
Returns a new sink that buffers writes to the sink. Writes will be efficiently "batched". Call SdkSink.flush when done to emit all data to the underlying sink.
Returns a new source that buffers reads from the underlying source. The returned source will perform bulk reads to an in-memory buffer making small reads efficient.