Package org.jmrtd.io
Class InputStreamBuffer
- java.lang.Object
-
- org.jmrtd.io.InputStreamBuffer
-
public class InputStreamBuffer extends Object
Buffers an inputstream (whose length is known in advance) and can supply clients with fresh "copies" of that inputstream served from the buffer. NOTE: the original inputstream should no longer be read from, clients should only read bytes from the sub-inputstreams.- Author:
- The JMRTD team ([email protected])
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
InputStreamBuffer.SubInputStream
The sub-input stream to serve to clients.
-
Constructor Summary
Constructors Constructor Description InputStreamBuffer(InputStream inputStream, int length)
Creates an input stream buffer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBytesBuffered()
Returns the number of bytes buffered so far.InputStreamBuffer.SubInputStream
getInputStream()
Returns a copy of the input stream positioned at0
.int
getLength()
Returns the size of the buffer.int
getPosition()
Returns the current position in the buffer.String
toString()
void
updateFrom(InputStreamBuffer other)
Updates this buffer based on some other buffer.
-
-
-
Constructor Detail
-
InputStreamBuffer
public InputStreamBuffer(InputStream inputStream, int length)
Creates an input stream buffer.- Parameters:
inputStream
- the input streamlength
- the length of the input stream
-
-
Method Detail
-
updateFrom
public void updateFrom(InputStreamBuffer other)
Updates this buffer based on some other buffer.- Parameters:
other
- the other buffer
-
getInputStream
public InputStreamBuffer.SubInputStream getInputStream()
Returns a copy of the input stream positioned at0
.- Returns:
- a copy of the input stream
-
getPosition
public int getPosition()
Returns the current position in the buffer.- Returns:
- the position in the buffer
-
getBytesBuffered
public int getBytesBuffered()
Returns the number of bytes buffered so far.- Returns:
- the number of bytes buffered so far
-
getLength
public int getLength()
Returns the size of the buffer.- Returns:
- the size of the buffer
-
-