public class ASBufferedInFilter extends ASInFilter
| Modifier and Type | Field and Description |
|---|---|
static int |
BF_BUFFER_SIZE |
protected byte[] |
buffer |
static int |
START_BUFFER_SIZE |
isClosed, isSourceClosed, resourceUsers| Constructor and Description |
|---|
ASBufferedInFilter(ASInputStream stream) |
ASBufferedInFilter(ASInputStream stream,
int buffCapacity) |
| Modifier and Type | Method and Description |
|---|---|
long |
addToBuffer(int bytesToAdd)
Reads next portion of data from the underlying stream and appends it to
the end of data, contained in internal buffer.
|
byte |
bufferPop()
Returns the character pointed by buffer begin marker and advances it.
|
int |
bufferPopArray(byte[] buffer,
int read)
Reads data from internal buffer into passed byte array and advances begin
marker.
|
int |
bufferSize() |
void |
closeResource()
Closes stream resource.
|
static byte[] |
concatenate(byte[] one,
int lengthOne,
byte[] two,
int lengthTwo) |
long |
feedBuffer(int bytesToRead)
Reads next portion of data from the underlying stream to the internal
buffer, updates begin and end pointers and returns number of bytes
actually placed in buffer.
|
int |
getBufferBegin() |
int |
getBufferCapacity() |
int |
getBufferEnd() |
int |
getReadCounter() |
ASInputStream |
getStream(int length)
Gets a stream that is a piece of this stream.
|
ASInputStream |
getStreamUntilToken(byte[] token)
Gets a stream that is a piece of this stream.
|
void |
initialize()
This method should be called before using ASBufferedInFilter as buffered
stream.
|
boolean |
isEOF() |
byte |
peek() |
byte |
peek(int i) |
int |
processBuffer(int bytesToProcess)
Shifts begin marker by up to bytesToProceed bytes to the right of to the
end of the buffer if bytesToProceed is too big.
|
int |
read(byte[] buffer) |
int |
read(byte[] buffer,
int size) |
byte |
readByte() |
void |
reset() |
void |
resetReadCounter() |
int |
skip(int size)
Skips given number of decoded bytes in stream.
|
void |
unread() |
void |
unread(int i) |
close, decrementResourceUsers, getInputStream, incrementResourceUsers, read, setInputStreamcreateStreamFromStreamavailable, mark, markSupported, read, skippublic static final int START_BUFFER_SIZE
public static final int BF_BUFFER_SIZE
protected byte[] buffer
public ASBufferedInFilter(ASInputStream stream) throws IOException
IOExceptionpublic ASBufferedInFilter(ASInputStream stream, int buffCapacity)
public void initialize()
throws IOException
IOExceptionpublic int read(byte[] buffer,
int size)
throws IOException
ASInFilterread in class ASInFilterIOExceptionpublic int read(byte[] buffer)
throws IOException
ASInFilterread in class ASInFilterIOExceptionpublic byte readByte()
throws IOException
IOExceptionpublic int processBuffer(int bytesToProcess)
bytesToProcess - amount of bytes to shift.public long feedBuffer(int bytesToRead)
throws IOException
bytesToRead - amount of bytes to read.IOExceptionpublic long addToBuffer(int bytesToAdd)
throws IOException
bytesToAdd - amount of bytes to read.IOExceptionpublic int getBufferBegin()
public int getBufferEnd()
public byte bufferPop()
public int bufferPopArray(byte[] buffer,
int read)
throws IOException
buffer - is byte array where data will be read.read - maximal amount of bytes to read.IOException - if passed buffer is too small to contain necessary
amount of bytes.public int bufferSize()
public int getBufferCapacity()
public void closeResource()
throws IOException
closeResource in class ASInFilterIOExceptionpublic void reset()
throws IOException
reset in class ASInFilterIOExceptionpublic static byte[] concatenate(byte[] one,
int lengthOne,
byte[] two,
int lengthTwo)
public int skip(int size)
throws IOException
skip in class ASInFiltersize - is amount of bytes to skip.IOException - if stream-reading error occurs.public byte peek()
throws IOException
IOExceptionpublic byte peek(int i)
throws IOException
IOExceptionpublic void unread()
throws IOException
IOExceptionpublic void unread(int i)
throws IOException
IOExceptionpublic boolean isEOF()
public void resetReadCounter()
public int getReadCounter()
public ASInputStream getStream(int length) throws IOException
length - is the length of new stream.IOExceptionpublic ASInputStream getStreamUntilToken(byte[] token) throws IOException
token - is the byte array that means the end of stream.IOExceptionCopyright © 2015–2020 The veraPDF Consortium. All rights reserved.