public class DatabaseStream
extends java.lang.Object
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);
Modifier | Constructor | Description |
---|---|---|
protected |
DatabaseStream(Cursor cursor,
DatabaseStreamConfig config) |
Modifier and Type | Method | Description |
---|---|---|
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 external file accessed by this database stream.
|
long |
size() |
Return the size in bytes of the external file accessed by the database
stream.
|
OperationStatus |
write(DatabaseEntry data,
long offset) |
Write to the external file accessed by the database stream.
|
protected DatabaseStream(Cursor cursor, DatabaseStreamConfig config)
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()
public Cursor getCursor()
Cursor
handle associated
with this database stream.
public OperationStatus read(DatabaseEntry data, long offset, int size) throws DatabaseException, java.lang.IllegalArgumentException
data
- the data read from the file
returned as output. Its byte array does not need to be initialized by the
caller.
offset
- the position in bytes in the file where the reading starts.
size
- the number of bytes to read.
OperationStatus.SUCCESS
if the operation succeeds.
java.lang.IllegalArgumentException
- if a failure occurs.
java.lang.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, java.lang.IllegalArgumentException
data
- the data DatabaseEntry
to write into the file.
offset
- the position in bytes in the file where the writing starts.
OperationStatus.SUCCESS
if the operation succeeds.
java.lang.IllegalArgumentException
- if the operation fails.
DatabaseException
- if a failure occurs.Copyright (c) 1996, 2020 Oracle and/or its affiliates. All rights reserved.