Class BlockedByteArrayInputStream
java.lang.Object
java.io.InputStream
org.apache.derby.impl.io.vfmem.BlockedByteArrayInputStream
- All Implemented Interfaces:
Closeable, AutoCloseable
An input stream reading from a blocked byte array.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longThe current position of the stream.private BlockedByteArrayThe underlying source. -
Constructor Summary
ConstructorsConstructorDescriptionBlockedByteArrayInputStream(BlockedByteArray src, long pos) Creates a new input stream reading from a blocked byte array. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the stream.(package private) longReturns the current position.intread()Reads a single byte.intread(byte[] buf, int offset, int len) Reads up tolenbytes.(package private) voidsetPosition(long newPos) Sets the position.Methods inherited from class InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
src
The underlying source. Set tonullwhen closed. -
pos
private long posThe current position of the stream.
-
-
Constructor Details
-
BlockedByteArrayInputStream
Creates a new input stream reading from a blocked byte array.- Parameters:
src- the source blocked byte arraypos- the initial position to start reading from
-
-
Method Details
-
setPosition
void setPosition(long newPos) Sets the position.- Parameters:
newPos- the new byte position
-
getPosition
long getPosition()Returns the current position.- Returns:
- The current byte position.
-
read
-
read
public int read(byte[] buf, int offset, int len) Reads up tolenbytes.- Overrides:
readin classInputStream- Parameters:
buf- destination bufferoffset- offset into the destination bufferlen- number of bytes to read- Returns:
- The number of bytes read.
-
close
public void close()Closes the stream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream
-