|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
org.apache.derby.impl.load.ImportFileInputStream
class ImportFileInputStream
An InputStream, which can stream data from a file, starting from
any offset in the file. This stream operates on top of a
RandomAccessFile object. This class overrides InputStream methods to
read from the given RandomAccessFile and provides an addtional method
seek(..)
to position the stream at offset in the file.
Field Summary | |
---|---|
private long |
currentPosition
|
private long |
fileLength
|
private java.io.RandomAccessFile |
raf
|
Constructor Summary | |
---|---|
ImportFileInputStream(java.io.RandomAccessFile raf)
Create a ImportFileInputStream object for
the given file. |
Method Summary | |
---|---|
int |
available()
Returns the number of bytes that can be read from this stream. |
void |
close()
Closes this input stream and releases any associated resources |
int |
read()
Reads a byte of data from this input stream. |
int |
read(byte[] buf,
int offset,
int length)
Reads up to length bytes of data from this input stream
into given array. |
(package private) void |
seek(long offset)
Sets the file offset at which the next read will occur. |
Methods inherited from class java.io.InputStream |
---|
mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.io.RandomAccessFile raf
private long currentPosition
private long fileLength
Constructor Detail |
---|
ImportFileInputStream(java.io.RandomAccessFile raf) throws java.io.IOException
ImportFileInputStream
object for
the given file.
raf
- file the stream reads from.
java.io.IOException
- if any I/O error occurs.Method Detail |
---|
void seek(long offset) throws java.io.IOException
offset
- byte offset in the file.
java.io.IOException
- if an I/O error occurs.public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
- if an I/O error occurs.public int read(byte[] buf, int offset, int length) throws java.io.IOException
length
bytes of data from this input stream
into given array. This method blocks until some input is
available.
read
in class java.io.InputStream
buf
- the buffer into which the data is read.offset
- the start offset of the data.length
- the maximum number of bytes read.
-1
if there is no more data because the end of
the file has been reached.
java.io.IOException
- if an I/O error occurs.public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
- if an I/O error occurs.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.InputStream
java.io.IOException
- if an I/O error occurs.
|
Built on Thu 2011-03-10 11:54:14+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |