Class IIOInputStreamAdapter
java.lang.Object
java.io.InputStream
com.twelvemonkeys.imageio.util.IIOInputStreamAdapter
- All Implemented Interfaces:
Closeable, AutoCloseable
IIOInputStreamAdapter
Note: You should always wrap this stream in a BufferedInputStream.
If not, performance may degrade significantly.
- Version:
- $Id: IIOInputStreamAdapter.java,v 1.0 Sep 26, 2007 11:35:59 AM haraldk Exp$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate ImageInputStreamprivate longprivate long -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreates anInputStreamthat reads from the givenImageInputStream.IIOInputStreamAdapter(ImageInputStream pInput, long pLength) Creates anInputStreamthat reads from the givenImageInputStream.privateIIOInputStreamAdapter(ImageInputStream pInput, long pLength, boolean pHasLength) -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()Marks this stream as closed.private longfindMaxLen(long pLength) Finds the maximum number of bytes we can read or skip, from this stream.voidmark(int pReadLimit) booleanintread()final intread(byte[] pBytes) intread(byte[] pBytes, int pOffset, int pLength) voidreset()longskip(long pLength) Methods inherited from class InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
input
-
hasLength
private final boolean hasLength -
left
private long left -
markPosition
private long markPosition
-
-
Constructor Details
-
IIOInputStreamAdapter
Creates anInputStreamthat reads from the givenImageInputStream. The input stream will read from the current stream position, until the end of the underlying stream.- Parameters:
pInput- theImageInputStreamto read from.
-
IIOInputStreamAdapter
Creates anInputStreamthat reads from the givenImageInputStream. The input stream will read from the current stream position, until at mostpLengthbytes has been read.- Parameters:
pInput- theImageInputStreamto read from.pLength- the length of the stream
-
IIOInputStreamAdapter
-
-
Method Details
-
close
Marks this stream as closed. This implementation does not close the underlying stream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
mark
public void mark(int pReadLimit) - Overrides:
markin classInputStream
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
findMaxLen
private long findMaxLen(long pLength) Finds the maximum number of bytes we can read or skip, from this stream. The number will be in the range[0 ... bytes left].- Parameters:
pLength- the requested length- Returns:
- the maximum number of bytes to read
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-