Package org.apache.derby.impl.io.vfmem
Class BlockedByteArrayInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.derby.impl.io.vfmem.BlockedByteArrayInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
class BlockedByteArrayInputStream extends java.io.InputStreamAn input stream reading from a blocked byte array.
-
-
Field Summary
Fields Modifier and Type Field Description private longposThe current position of the stream.private BlockedByteArraysrcThe underlying source.
-
Constructor Summary
Constructors Constructor Description BlockedByteArrayInputStream(BlockedByteArray src, long pos)Creates a new input stream reading from a blocked byte array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the stream.(package private) longgetPosition()Returns 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.
-
-
-
Field Detail
-
src
private BlockedByteArray src
The underlying source. Set tonullwhen closed.
-
pos
private long pos
The current position of the stream.
-
-
Constructor Detail
-
BlockedByteArrayInputStream
public BlockedByteArrayInputStream(BlockedByteArray src, long pos)
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 Detail
-
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
public int read()
Reads a single byte.- Specified by:
readin classjava.io.InputStream- Returns:
- A byte.
-
read
public int read(byte[] buf, int offset, int len)Reads up tolenbytes.- Overrides:
readin classjava.io.InputStream- 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 interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream
-
-