Package ij.io
Class RandomAccessStream
java.lang.Object
java.io.InputStream
ij.io.RandomAccessStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
This class uses a memory cache to allow seeking within
an InputStream. Based on the JAI MemoryCacheSeekableStream class.
Can also be constructed from a RandomAccessFile, which uses less
memory since the memory cache is not required.
-
Constructor Summary
ConstructorsConstructorDescriptionRandomAccessStream
(InputStream inputstream) Constructs a RandomAccessStream from an InputStream.Constructs a RandomAccessStream from an RandomAccessFile. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
int
long
int
read()
int
read
(byte[] bytes, int off, int len) final double
final float
final void
readFully
(byte[] bytes) final void
readFully
(byte[] bytes, int len) final int
readInt()
final long
readLong()
final short
void
seek
(int loc) void
seek
(long loc) Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
RandomAccessStream
Constructs a RandomAccessStream from an InputStream. Seeking backwards is supported using a memory cache. -
RandomAccessStream
Constructs a RandomAccessStream from an RandomAccessFile.
-
-
Method Details
-
getFilePointer
- Throws:
IOException
-
getLongFilePointer
- Throws:
IOException
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
readFully
- Throws:
IOException
-
readFully
- Throws:
IOException
-
seek
- Throws:
IOException
-
seek
- Throws:
IOException
-
readInt
- Throws:
IOException
-
readLong
- Throws:
IOException
-
readDouble
- Throws:
IOException
-
readShort
- Throws:
IOException
-
readFloat
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-