edu.harvard.hul.ois.jhove.module.jpeg2000
Class FragmentInputStream
java.lang.Object
java.io.InputStream
edu.harvard.hul.ois.jhove.module.jpeg2000.FragmentInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class FragmentInputStream
- extends java.io.InputStream
A FragmentInputStream provides an interface by which
the scattered fragments of a Fragment List Box can
be read as a single stream. Only fragments within
the originating file are supported, not fragments
in external files.
- Author:
- Gary McGath
Constructor Summary |
FragmentInputStream(java.util.List<long[]> fragments,
java.io.RandomAccessFile raf)
|
FragmentInputStream(java.util.List<long[]> fragments,
java.io.RandomAccessFile raf,
int bufSize)
|
Method Summary |
int |
read()
Returns the next byte from the stream, buffering each fragment
in turn until the last fragment is exhausted. |
Methods inherited from class java.io.InputStream |
available, close, mark, markSupported, read, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FragmentInputStream
public FragmentInputStream(java.util.List<long[]> fragments,
java.io.RandomAccessFile raf)
- Parameters:
fragments
- List of fragment entries.
Each fragment entry is an array of two longs,
with fragment[0] being the length and
fragment[1] the offset.
FragmentInputStream
public FragmentInputStream(java.util.List<long[]> fragments,
java.io.RandomAccessFile raf,
int bufSize)
read
public int read()
throws java.io.IOException
- Returns the next byte from the stream, buffering each fragment
in turn until the last fragment is exhausted.
- Specified by:
read
in class java.io.InputStream
- Returns:
- The next byte of the stream, or -1 to indicate no
more bytes are available.
- Throws:
java.io.IOException