RecyclableBufferedInputStream

open class RecyclableBufferedInputStream : FilterInputStream

Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input stream is minimized, since most (smaller) requests can be satisfied by accessing the buffer alone. The drawback is that some extra space is required to hold the buffer and that copying takes place when filling that buffer, but this is usually outweighed by the performance benefits.

A typical application pattern for the class looks like this:

BufferedInputStream buf = new BufferedInputStream(new FileInputStream("file.java"));

Constructors

Link copied to clipboard
open fun RecyclableBufferedInputStream(in: InputStream, byteArrayPool: ArrayPool)

Functions

Link copied to clipboard
open fun available(): Int
Returns an estimated number of bytes that can be read or skipped without blocking for more input.
Link copied to clipboard
open fun close()
Closes this stream.
Link copied to clipboard
open fun fixMarkLimit()
Reduces the mark limit to match the current buffer length to prevent the buffer from continuing to increase in size.
Link copied to clipboard
open fun mark(readlimit: Int)
Sets a mark position in this stream.
Link copied to clipboard
open fun markSupported(): Boolean
Indicates whether BufferedInputStream supports the mark and reset methods.
Link copied to clipboard
open fun nullInputStream(): InputStream
Link copied to clipboard
open fun read(): Int
Reads a single byte from this stream and returns it as an integer in the range from 0 to 255.
open fun read(    buffer: Array<Byte>,     offset: Int,     byteCount: Int): Int
Reads at most byteCount bytes from this stream and stores them in byte array buffer starting at offset offset.
Link copied to clipboard
open fun readAllBytes(): Array<Byte>
Link copied to clipboard
open fun readNBytes(len: Int): Array<Byte>
open fun readNBytes(    b: Array<Byte>,     off: Int,     len: Int): Int
Link copied to clipboard
open fun release()
Link copied to clipboard
open fun reset()
Resets this stream to the last marked location.
Link copied to clipboard
open fun skip(byteCount: Long): Long
Skips byteCount bytes in this stream.
Link copied to clipboard
open fun transferTo(out: OutputStream): Long