Determines whether the input stream has nBytes more bytes available starting at the current byte position.
Determines whether the input stream has nBytes more bytes available starting at the current byte position. Read bytes are cached in buckets. Blocks until either nBytes are known to be available or EOF is reached. Does not advance the current byte position.
the number of bytes to determine if are available
true if nBytes are available, false otherwise
Calculate how many bytes are currently buffered starting from the current position
Calculate how many bytes are currently buffered starting from the current position
This should be called when at the end of a parse when all marks have been released, or just called periodically to ensure the size of the buckets arraybuffer does not grow too big.
This should be called when at the end of a parse when all marks have been released, or just called periodically to ensure the size of the buckets arraybuffer does not grow too big. This will move all existing buckets to the front of the buckets ArrayBuffer and update offsets accordingly. This way, there are not a bunch of null empty buckets at the front of the buckets array taking up space.
Return a byte array with data from the current byte position.
Return a byte array with data from the current byte position. Stores the next len bytes of data in dest starting at index off. Returns true if len bytes are available, false otherwise and writes nothing to dest.
true if len bytes are available and written to the dest array, false otherwise
Return a single byte at the current byte position.
Return a single byte at the current byte position. Increments curBytePosition0b if successful. The Byte is return as an integer in the range 0 to 255. Returns -1 if EOF is reached.
the byte at the current byte position if it exists, or -1 if EOF is reached.
Set the specified byte position as a location that that one may want to call setPosition in the future.
Set the specified byte position as a location that that one may want to call setPosition in the future. This is essentially setting a mark in the data that can be reset back to later. Implementations are allowed to free any bytes before a locked byte position. Any bytes after a locked position cannot be freed until that lock is release.
Note that this "lock" has nothing to do with synchronization, but behaves more like marks that must be accessable until released.
the byte position to lock
Set the current byte position, using zero-based indexing
Set the current byte position, using zero-based indexing
bytPos0b cannot be greater than the most recent read data. In other words, this can only be used to move backwards in data.
the new current byte position
Get the current byte position, using zero-based indexing
Get the current byte position, using zero-based indexing
the current byte position
Release a previously locked byte position, allowing the implementation to free any unlocked bytes.
Release a previously locked byte position, allowing the implementation to free any unlocked bytes.
the byte position to release
Implements the InputSource interface, reading data from a generic java.io.InputStream and storing the data in buckets of a defined size. Buckets are freed when no "locks" exist inside the bucket to minimize memory usage. Note that "locks" in this sense are the InputSource locks on bytePosition and are not about syncrhonization. This more of a reference count, counting buckets to determine which buckets are no longer needed and can be freed when the reference count goes to zero.