Top Description Fields Constructors Methods
org.apache.derby.impl.load

pack-priv Class ImportFileInputStream

Located in compilation unit of org.apache.derby.impl.load.ImportLobFile.

extends InputStream
Class Inheritance

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

Modifier and TypeField and Description
private long
private long
private RandomAccessFile

Constructor Summary

AccessConstructor and Description
pack-priv
ImportFileInputStream(RandomAccessFile
file the stream reads from.
raf
)

Create a ImportFileInputStream object for the given file.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the number of bytes that can be read from this stream.
available
()

Overrides java.io.InputStream.available.

Returns the number of bytes that can be read from this stream.

public void
close()

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Closes this input stream and releases any associated resources

public int
read()

Implements abstract java.io.InputStream.read.

Reads a byte of data from this input stream.

public int

Returns:

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached.
read
(byte[]
the buffer into which the data is read.
buf
,
int
the start offset of the data.
offset
,
int
the maximum number of bytes read.
length
)

Overrides java.io.InputStream.read.

Reads up to length bytes of data from this input stream into given array.

pack-priv void
seek(long
byte offset in the file.
offset
)

Sets the file offset at which the next read will occur.

Inherited from java.io.InputStream:
markmarkSupportednullInputStreamreadreadAllBytesreadNBytesreadNBytesresetskipskipNBytestransferTo

Field Detail

currentPositionback to summary
private long currentPosition
fileLengthback to summary
private long fileLength
rafback to summary
private RandomAccessFile raf

Constructor Detail

ImportFileInputStreamback to summary
pack-priv ImportFileInputStream(RandomAccessFile raf) throws IOException

Create a ImportFileInputStream object for the given file.

Parameters
raf:RandomAccessFile

file the stream reads from.

Exceptions
IOException:
if any I/O error occurs.

Method Detail

availableback to summary
public int available() throws IOException

Overrides java.io.InputStream.available.

Returns the number of bytes that can be read from this stream.

Returns:int

the number of bytes that can be read from this stream.

Exceptions
IOException:
if an I/O error occurs.
closeback to summary
public void close() throws IOException

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Closes this input stream and releases any associated resources

Exceptions
IOException:
if an I/O error occurs.
readback to summary
public int read() throws IOException

Implements abstract java.io.InputStream.read.

Reads a byte of data from this input stream.

Returns:int

Doc from java.io.InputStream.read.

the next byte of data, or -1 if the end of the stream is reached.

Exceptions
IOException:
if an I/O error occurs.
readback to summary
public int read(byte[] buf, int offset, int length) throws IOException

Overrides java.io.InputStream.read.

Reads up to length bytes of data from this input stream into given array. This method blocks until some input is available.

Parameters
buf:byte[]

the buffer into which the data is read.

offset:int

the start offset of the data.

length:int

the maximum number of bytes read.

Returns:int

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached.

Exceptions
IOException:
if an I/O error occurs.
seekback to summary
pack-priv void seek(long offset) throws IOException

Sets the file offset at which the next read will occur.

Parameters
offset:long

byte offset in the file.

Exceptions
IOException:
if an I/O error occurs.