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 voidclose()longgetStreamPointer()intread()intread(byte[] bytes, int off, int len)voidseek(long loc)voidshallowClose()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:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
getStreamPointer
public long getStreamPointer()- Specified by:
getStreamPointerin classRandomAccessInputStream
-
read
public int read() throws java.io.IOException- Specified by:
readin classRandomAccessInputStream- Throws:
java.io.IOException
-
read
public int read(byte[] bytes, int off, int len) throws java.io.IOException- Specified by:
readin classRandomAccessInputStream- Throws:
java.io.IOException
-
seek
public void seek(long loc) throws java.io.IOException- Specified by:
seekin classRandomAccessInputStream- Throws:
java.io.IOException
-
shallowClose
public void shallowClose() throws java.io.IOExceptionDescription copied from class:RandomAccessInputStreamCloses the RandomAccessInputStream and it's underlying stream- Specified by:
shallowClosein classRandomAccessInputStream- Throws:
java.io.IOException
-