Skip Headers

Oracle® interMedia Java Classes Reference
10g Release 1 (10.1)

Part Number B10830-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

BlobInputStream Object

This section presents reference information on the methods associated with the BlobInputStream object, which provides an interface for JAI to read data from BLOBs. 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 BlobInputStream object, the following operations must have already been performed:


BlobInputStream(BLOB)

Format

public BlobInputStream(oracle.sql.BLOB blob)

Description

Creates a BlobInputStream object that reads from the specified BLOB. The constructor uses an optimal chunk size that is determined by the database.

Parameters

blob

The BLOB from which data will be read.

Return Value

None.

Exceptions

java.io.IOException

java.sql.SQLException

Examples

None.


BlobInputStream(BLOB, int)

Format

public BlobInputStream(oracle.sql.BLOB blob, int chunkSize)

Description

Creates a BlobInputStream object that reads from the specified BLOB. The constructor uses the specified chunk size.

Parameters

blob

The BLOB from which data will be read.

chunkSize

The maximum amount of data to read from the BLOB at one time.

Return Value

None.

Exceptions

java.io.IOException

java.sql.SQLException

Examples

None.


canSeekBackwards( )

Format

public boolean canSeekBackwards( )

Description

Checks whether or not the stream can read backwards. Because the BlobInputStream object can read backwards, this method will always return true.

Parameters

None.

Return Value

This method returns true.

Exceptions

None.

Examples

None.


close( )

Format

public void close( )

Description

Closes the BlobInputStream object, releasing any resources being used.

Parameters

None.

Return Value

None.

Exceptions

java.io.IOException

Examples

None.


getBLOB( )

Format

public oracle.sql.BLOB getBLOB( )

Description

Returns the BLOB associated with the BlobInputStream object.

Parameters

None.

Return Value

This method returns the BLOB associated with the BlobInputStream object.

Exceptions

None.

Examples

None.


getFilePointer( )

Format

public long getFilePointer( )

Description

Returns the offset from the beginning of the BLOB at which the next read operation will occur.

Parameters

None.

Return Value

This method returns the offset from the beginning of the BLOB at which the next read operation will occur, in bytes.

Exceptions

java.io.IOException

Examples

None.


mark(int)

Format

public void mark(int readLimit)

Description

Marks the current position in the BlobInputStream object. A call to the reset( ) method will return you to the last marked position in the BlobInputStream object.

Parameters

readLimit

This argument is ignored by the class.

Return Value

None.

Exceptions

None.

Examples

None.


markSupported( )

Format

public boolean markSupported( )

Description

Checks whether or not the BlobInputStream object supports marking. Because the BlobInputStream object supports marking, this method will always return true.

Parameters

None.

Return Value

This method returns true.

Exceptions

None.

Examples

None.


read( )

Format

public int read( )

Description

Reads a single byte from the BLOB associated with the BlobInputStream object.

Parameters

None.

Return Value

This method returns the byte of data that is read, or -1 if the end of the BLOB has been reached.

Exceptions

java.io.IOException

Examples

None.


read(byte[ ])

Format

public int read(byte[ ] buffer)

Description

Reads data from the BLOB into the specified buffer.

Parameters

buffer

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 BLOB was reached before any data was read. The value cannot exceed the length of the buffer.

Exceptions

java.io.IOException

Examples

None.


read(byte[ ], int, int)

Format

public int read(byte[ ]buffer, int off, int len)

Description

Reads up to the specified length of data from the BLOB into the specified buffer, starting from the specified offset.

Parameters

buffer

The buffer into which the data is read.

off

The offset from the beginning of the buffer at which data will be written, in bytes.

len

The maximum number of bytes to be written to the buffer.

Return Value

This method returns the number of bytes read into the buffer, or -1 if the end of the BLOB has been reached. The value cannot exceed the length of the buffer.

Exceptions

java.io.IOException

Examples

None.


remaining( )

Format

public long remaining( )

Description

Returns the number of unread bytes remaining in the BLOB.

Parameters

None.

Return Value

This method returns the number of unread bytes in the BLOB.

Exceptions

None.

Examples

None.


reset( )

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.


seek(long)

Format

public void seek(long pos)

Description

Sets the offset from the beginning of the BLOB at which the next read operation should occur.

Parameters

pos

The offset from the beginning of the BLOB at which the next read operation should occur.

Return Value

None.

Exceptions

java.io.IOException

Examples

None.


skip(long)

Format

public long skip(long n)

Description

Attempts to skip over the specified number of bytes in the BLOB.

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

n

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.