Class InputStreamByteSource
- java.lang.Object
-
- org.apache.commons.imaging.bytesource.ByteSource
-
- org.apache.commons.imaging.bytesource.InputStreamByteSource
-
final class InputStreamByteSource extends ByteSource
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classInputStreamByteSource.BlockA block of bytes (a byte array).private classInputStreamByteSource.BlockInputStream
-
Field Summary
Fields Modifier and Type Field Description private static intBLOCK_SIZEprivate InputStreamByteSource.BlockheadBlockprivate java.io.InputStreaminputStreamprivate longstreamLength
-
Constructor Summary
Constructors Constructor Description InputStreamByteSource(java.io.InputStream inputStream, java.lang.String fileName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getByteArray(long position, int length)private InputStreamByteSource.BlockgetFirstBlock()java.io.InputStreamgetInputStream()private InputStreamByteSource.BlockreadBlock()longsize()This operation can be VERY expensive; for InputStream byte sources, the entire stream must be drained to determine its length.-
Methods inherited from class org.apache.commons.imaging.bytesource.ByteSource
array, array, file, getFileName, getInputStream, inputStream, path, toString
-
-
-
-
Field Detail
-
BLOCK_SIZE
private static final int BLOCK_SIZE
- See Also:
- Constant Field Values
-
inputStream
private final java.io.InputStream inputStream
-
headBlock
private final InputStreamByteSource.Block headBlock
-
streamLength
private long streamLength
-
-
Method Detail
-
getByteArray
public byte[] getByteArray(long position, int length) throws java.io.IOException- Overrides:
getByteArrayin classByteSource- Throws:
java.io.IOException
-
getFirstBlock
private InputStreamByteSource.Block getFirstBlock() throws java.io.IOException
- Throws:
java.io.IOException
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException- Overrides:
getInputStreamin classByteSource- Throws:
java.io.IOException
-
readBlock
private InputStreamByteSource.Block readBlock() throws java.io.IOException
- Throws:
java.io.IOException
-
size
public long size() throws java.io.IOExceptionDescription copied from class:ByteSourceThis operation can be VERY expensive; for InputStream byte sources, the entire stream must be drained to determine its length.- Overrides:
sizein classByteSource- Returns:
- the byte source length
- Throws:
java.io.IOException- if it fails to read the byte source data
-
-