Oracle® interMedia Java Classes Reference 10g Release 1 (10.1) Part Number B10830-01 |
|
|
View PDF |
This section presents reference information on the methods associated with the BfileInputStream object, which provides an interface for JAI to read data from BFILEs. It is a subclass of com.sun.media.jai.codec.SeekableStream and java.io.InputStream; it implements java.io.DataInput.
Before running the methods associated with the BfileInputStream object, the following operations must have already been performed:
The following import statements have been included:
import javax.media.jai.JAI; import java.awt.image.RenderedImage;
A local BfileInputStream object named inStream has been created.
Format
public BfileInputStream(oracle.sql.BFILE bfile)
Description
Creates a BfileInputStream object that reads from the specified BFILE. The constructor uses the maximum chunk size defined for a BFILE. The BFILE will be opened after this constructor executes.
Parameters
The BFILE from which data will be read.
Return Value
None.
Exceptions
java.io.IOException
java.sql.SQLException
Examples
None.
Format
public BfileInputStream(oracle.sql.BFILE bfile, int chunkSize)
Description
Creates a BfileInputStream object that reads from the specified BFILE. The constructor uses the specified chunk size. The BFILE will be opened after this constructor executes.
Parameters
The BFILE from which data will be read.
The maximum amount of data to read from the BFILE at one time.
Return Value
None.
Exceptions
java.io.IOException
java.sql.SQLException
Examples
None.
Format
public boolean canSeekBackwards( )
Description
Checks whether or not the stream can read backwards. Because the BfileInputStream object can read backwards, this method will always return true.
Parameters
None.
Return Value
This method returns true.
Exceptions
None.
Examples
None.
Format
public void close( )
Description
Closes the BfileInputStream object, releasing any resources being used. The BFILE automatically closes after the stream closes.
Parameters
None.
Return Value
None.
Exceptions
java.io.IOException
Examples
None.
Format
public oracle.sql.BFILE getBFILE( )
Description
Returns the BFILE associated with the BfileInputStream object.
Parameters
None.
Return Value
This method returns the BFILE associated with the BfileInputStream object.
Exceptions
None.
Examples
None.
Format
public long getFilePointer( )
Description
Returns the offset from the beginning of the BFILE at which the next read operation will occur.
Parameters
None.
Return Value
This method returns the offset from the beginning of the BFILE at which the next read operation will occur, in bytes.
Exceptions
java.io.IOException
Examples
None.
Format
public void mark(int readLimit)
Description
Marks the current position in the BfileInputStream object. A call to the reset( ) method will return you to the last marked position in the BfileInputStream object.
Parameters
This argument is ignored by the class.
Return Value
None.
Exceptions
None.
Examples
None.
Format
public boolean markSupported( )
Description
Checks whether or not the BfileInputStream object supports marking. Because the BfileInputStream object supports marking, this method will always return true.
Parameters
None.
Return Value
This method returns true.
Exceptions
None.
Examples
None.
Format
public int read( )
Description
Reads a single byte from the BFILE associated with the BfileInputStream object.
Parameters
None.
Return Value
This method returns the byte of data that is read, or -1 if the end of the BFILE has been reached.
Exceptions
java.io.IOException
Examples
None.
Format
public int read(byte[ ] buffer)
Description
Reads data from the BFILE into the specified buffer.
Parameters
The buffer into which the data is read.
Return Value
This method returns the number of bytes read into the buffer, or -1 if the end of the BFILE was reached before any data was read. The value cannot exceed the length of the buffer.
Exceptions
java.io.IOException
Examples
None.
Format
public int read(byte[ ]buffer, int off, int len)
Description
Reads up to the specified length of data from the BFILE into the specified buffer, starting from the specified offset.
Parameters
The buffer into which the data is read.
The offset from the beginning of the buffer at which data will be written, in bytes.
The maximum number of bytes to be read into the buffer.
Return Value
This method returns the number of bytes read, or -1 if the end of the BFILE was reached before any data was read. The value cannot exceed the length of the buffer.
Exceptions
java.io.IOException
Examples
None.
Format
public long remaining( )
Description
Returns the number of unread bytes remaining in the BFILE.
Parameters
None.
Return Value
This method returns the number of unread bytes in the BFILE.
Exceptions
None.
Examples
None.
Format
public void reset( )
Description
Repositions the stream to the position of the last valid mark.
Parameters
None.
Return Value
None.
Exceptions
java.io.IOException
Examples
None.
Format
public void seek(long pos)
Description
Sets the offset from the beginning of the BFILE at which the next read operation should occur.
Parameters
The offset from the beginning of the BFILE at which the next read operation should occur.
Return Value
None.
Exceptions
java.io.IOException
Examples
None.
Format
public long skip(long n)
Description
Attempts to skip over the specified number of bytes in the BFILE.
The number of bytes skipped may be smaller than the specified number; for example, the number would be smaller if the end of the file is reached.
Parameters
The number of bytes to be skipped.
Return Value
This method returns the number of bytes that are actually skipped.
Exceptions
java.io.IOException
Examples
None.