Package pixy.io
Class MemoryCacheRandomAccessInputStream
java.lang.Object
java.io.InputStream
pixy.io.RandomAccessInputStream
pixy.io.MemoryCacheRandomAccessInputStream
- All Implemented Interfaces:
java.io.Closeable
,java.io.DataInput
,java.lang.AutoCloseable
public class MemoryCacheRandomAccessInputStream extends RandomAccessInputStream
Implements a memory cached random access input stream to ease the
decoding of some types of images such as TIFF which may need random
access to the underlying stream.
Based on com.sun.media.jai.codec.MemoryCacheSeekableStream.
This implementation has a major drawback: It has no knowledge of the length of the stream, it is supposed to move forward even though it is possible to put the pointer at anywhere before the end of the stream.
- Version:
- 1.0 02/09/2014
- Author:
- Wen Yu, yuwen_66@yahoo.com
-
Field Summary
-
Constructor Summary
Constructors Constructor Description MemoryCacheRandomAccessInputStream(java.io.InputStream src)
-
Method Summary
Modifier and Type Method Description void
close()
long
getStreamPointer()
int
read()
int
read(byte[] bytes, int off, int len)
void
seek(long loc)
void
shallowClose()
Closes the RandomAccessInputStream and it's underlying streamMethods inherited from class pixy.io.RandomAccessInputStream
ensureOpen, finalize, getEndian, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readS15Fixed16Number, readShort, readU16Fixed16Number, readU8Fixed8Number, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, setReadStrategy, skipBytes
-
Constructor Details
-
MemoryCacheRandomAccessInputStream
public MemoryCacheRandomAccessInputStream(java.io.InputStream src)
-
-
Method Details
-
close
public void close() throws java.io.IOException- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
-
getStreamPointer
public long getStreamPointer()- Specified by:
getStreamPointer
in classRandomAccessInputStream
-
read
public int read() throws java.io.IOException- Specified by:
read
in classRandomAccessInputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] bytes, int off, int len) throws java.io.IOException- Specified by:
read
in classRandomAccessInputStream
- Throws:
java.io.IOException
-
seek
public void seek(long loc) throws java.io.IOException- Specified by:
seek
in classRandomAccessInputStream
- Throws:
java.io.IOException
-
shallowClose
public void shallowClose() throws java.io.IOExceptionDescription copied from class:RandomAccessInputStream
Closes the RandomAccessInputStream and it's underlying stream- Specified by:
shallowClose
in classRandomAccessInputStream
- Throws:
java.io.IOException
-