|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
edu.harvard.hul.ois.jhove.RAFInputStream
public class RAFInputStream
An InputStream layered on top of a RandomAccessFile. This is useful for a Module which has requirements that force it to use a RandomAccessFile, but is usually accessed sequentially. An RAFInputStream maintains its own position information in the file, so multiple RAFInputStreams in the same file will work without interference. However, this class is not thread-safe.
Constructor Summary | |
---|---|
RAFInputStream(java.io.RandomAccessFile raf)
Constructor with default buffer size. |
|
RAFInputStream(java.io.RandomAccessFile raf,
int bufferSize)
Constructor with buffer size. |
Method Summary | |
---|---|
long |
getFilePos()
Returns the current position in the file. |
java.io.RandomAccessFile |
getRAF()
Returns the RandomAccessFile object. |
int |
read()
Reads a single byte from the file. |
int |
read(byte[] b)
Reads some number of bytes from the input stream and stores them into the buffer array b. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from the input stream into an array of bytes. |
void |
seek(long offset)
Positions the stream to a different point in the file. |
long |
skip(long n)
Skips some number of bytes. |
Methods inherited from class java.io.InputStream |
---|
available, close, mark, markSupported, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RAFInputStream(java.io.RandomAccessFile raf)
raf
- The file on which the
stream is to be based.public RAFInputStream(java.io.RandomAccessFile raf, int bufferSize)
raf
- The file on which the
stream is to be based.bufferSize
- The buffer size to be used.
If less than or equal to 0, the
default buffer size is used.Method Detail |
---|
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public long skip(long n) throws java.io.IOException
skip
in class java.io.InputStream
java.io.IOException
public java.io.RandomAccessFile getRAF()
public void seek(long offset) throws java.io.IOException
java.io.IOException
public long getFilePos() throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |