|
Berkeley DB version 6.1.19 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.db.DatabaseStream
public class DatabaseStream
A database stream. The database stream is used to access the blob.
Once the database stream close method has been called, the handle may not be accessed again.
To obtain a database stream with default attributes:
To customize the attributes of a database stream, use a DatabaseStreamConfig object.DatabaseStream dbs = myCursor.openDatabaseStream(null);
DatabaseStreamConfig config = new DatabaseStreamConfig(); config.setReadOnly(true); DatabaseStream dbs = myCursor.openDatabaseStream(config);
Constructor Summary | |
---|---|
protected |
DatabaseStream(Cursor cursor,
DatabaseStreamConfig config)
|
Method Summary | |
---|---|
void |
close()
Discard the database stream. |
DatabaseStreamConfig |
getConfig()
Return this database stream configuration. |
Cursor |
getCursor()
Return the Cursor handle associated
with this database stream. |
OperationStatus |
read(DatabaseEntry data,
long offset,
int size)
Read from the blob accessed by this database stream. |
long |
size()
Return the size in bytes of the blob accessed by the database stream. |
OperationStatus |
write(DatabaseEntry data,
long offset)
Write to the blob accessed by the database stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected DatabaseStream(Cursor cursor, DatabaseStreamConfig config)
Method Detail |
---|
public void close() throws DatabaseException
After the close method has been called, you cannot use the database stream handle again.
It is recommended to always close all database stream handles immediately after their use to release resources.
DatabaseException
- if a failure occurs.public DatabaseStreamConfig getConfig()
DatabaseException
- if a failure occurs.public Cursor getCursor()
Cursor
handle associated
with this database stream.
public OperationStatus read(DatabaseEntry data, long offset, int size) throws DatabaseException, IllegalArgumentException
data
- the data read from the blob
returned as output. Its byte array does not need to be initialized by the
caller.
offset
- the position in bytes in the blob where the reading starts.
size
- the number of bytes to read.
OperationStatus.SUCCESS
if the operation succeeds.
IllegalArgumentException
- if a failure occurs.
IllegalArgumentException
- if the operation fails.
DatabaseException
- if a failure occurs.public long size() throws DatabaseException
DatabaseException
- if a failure occurs.public OperationStatus write(DatabaseEntry data, long offset) throws DatabaseException, IllegalArgumentException
data
- the data DatabaseEntry
to write into the blob.
offset
- the position in bytes in the blob where the writing starts.
OperationStatus.SUCCESS
if the operation succeeds.
IllegalArgumentException
- if the operation fails.
DatabaseException
- if a failure occurs.
|
Berkeley DB version 6.1.19 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |