org.icepdf.core.pobjects.filters
Class ChunkingInputStream
java.lang.Object
java.io.InputStream
org.icepdf.core.pobjects.filters.ChunkingInputStream
- All Implemented Interfaces:
- java.io.Closeable
- Direct Known Subclasses:
- ASCII85Decode, ASCIIHexDecode, FlateDecode, LZWDecode, PredictorDecode, RunLengthDecode
public abstract class ChunkingInputStream
- extends java.io.InputStream
Most of the filters have to read in a chunk of data from their input stream,
and do some processing on it, before they can make it available to others
- Since:
- 2.0
- Author:
- Mark Collette
|
Field Summary |
protected byte[] |
buffer
|
protected java.io.InputStream |
in
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
in
protected java.io.InputStream in
buffer
protected byte[] buffer
ChunkingInputStream
public ChunkingInputStream()
setInputStream
protected void setInputStream(java.io.InputStream input)
setBufferSize
protected void setBufferSize(int size)
fillBufferFromInputStream
protected int fillBufferFromInputStream()
throws java.io.IOException
- For some reason, when reading from InflaterInputStream, if we ask to
fill a buffer, it will instead only give us a chunk at a time,
even though more data is available, and buffer.length has bee requested
- Throws:
java.io.IOException
fillBufferFromInputStream
protected int fillBufferFromInputStream(int offset,
int length)
throws java.io.IOException
- Throws:
java.io.IOException
fillInternalBuffer
protected abstract int fillInternalBuffer()
throws java.io.IOException
- This is only called if bufferAvailable is 0.
Implementations should read in more data, and return how many bytes are now available
- Throws:
java.io.IOException
markSupported
public boolean markSupported()
- Overrides:
markSupported in class java.io.InputStream
mark
public void mark(int readlimit)
- Overrides:
mark in class java.io.InputStream
reset
public void reset()
throws java.io.IOException
- Overrides:
reset in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read()
throws java.io.IOException
- Specified by:
read in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read(byte[] b)
throws java.io.IOException
- Overrides:
read in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read(byte[] b,
int off,
int length)
throws java.io.IOException
- Overrides:
read in class java.io.InputStream
- Throws:
java.io.IOException
skip
public long skip(long n)
throws java.io.IOException
- Overrides:
skip in class java.io.InputStream
- Throws:
java.io.IOException
available
public int available()
throws java.io.IOException
- Overrides:
available in class java.io.InputStream
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close in interface java.io.Closeable- Overrides:
close in class java.io.InputStream
- Throws:
java.io.IOException
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object