Class ByteSourceInputStream
- java.lang.Object
-
- org.apache.commons.imaging.common.bytesource.ByteSource
-
- org.apache.commons.imaging.common.bytesource.ByteSourceInputStream
-
public class ByteSourceInputStream extends ByteSource
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
ByteSourceInputStream.CacheBlock
private class
ByteSourceInputStream.CacheReadingInputStream
-
Field Summary
Fields Modifier and Type Field Description private static int
BLOCK_SIZE
private ByteSourceInputStream.CacheBlock
cacheHead
private java.io.InputStream
is
private byte[]
readBuffer
private long
streamLength
-
Constructor Summary
Constructors Constructor Description ByteSourceInputStream(java.io.InputStream is, java.lang.String fileName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getAll()
byte[]
getBlock(long blockStart, int blockLength)
java.lang.String
getDescription()
private ByteSourceInputStream.CacheBlock
getFirstBlock()
java.io.InputStream
getInputStream()
long
getLength()
This operation can be VERY expensive; for inputstream byte sources, the entire stream must be drained to determine its length.private ByteSourceInputStream.CacheBlock
readBlock()
-
Methods inherited from class org.apache.commons.imaging.common.bytesource.ByteSource
getBlock, getFileName, getInputStream
-
-
-
-
Field Detail
-
BLOCK_SIZE
private static final int BLOCK_SIZE
- See Also:
- Constant Field Values
-
is
private final java.io.InputStream is
-
cacheHead
private ByteSourceInputStream.CacheBlock cacheHead
-
readBuffer
private byte[] readBuffer
-
streamLength
private long streamLength
-
-
Method Detail
-
readBlock
private ByteSourceInputStream.CacheBlock readBlock() throws java.io.IOException
- Throws:
java.io.IOException
-
getFirstBlock
private ByteSourceInputStream.CacheBlock getFirstBlock() throws java.io.IOException
- Throws:
java.io.IOException
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException
- Specified by:
getInputStream
in classByteSource
- Throws:
java.io.IOException
-
getBlock
public byte[] getBlock(long blockStart, int blockLength) throws java.io.IOException
- Specified by:
getBlock
in classByteSource
- Throws:
java.io.IOException
-
getLength
public long getLength() throws java.io.IOException
Description copied from class:ByteSource
This operation can be VERY expensive; for inputstream byte sources, the entire stream must be drained to determine its length.- Specified by:
getLength
in classByteSource
- Returns:
- the byte source length
- Throws:
java.io.IOException
- if it fails to read the byte source data
-
getAll
public byte[] getAll() throws java.io.IOException
- Specified by:
getAll
in classByteSource
- Throws:
java.io.IOException
-
getDescription
public java.lang.String getDescription()
- Specified by:
getDescription
in classByteSource
-
-