| com.sun.midp.rms.AbstractRecordStoreFile
AbstractRecordStoreFile | interface AbstractRecordStoreFile (Code) | | A RecordStoreFile is a file abstraction layer between a
a RecordStore and an underlying persistent storage mechanism.
The underlying storage methods are provided by the
RandomAccessStream and File classes.
RecordStoreFile confines the namespace of a record store to
the scope of the MIDlet suite of its creating application.
It also ensures unicode recordstore names are ascii filesystem safe.
The RecordStoreImpl class can be implemented directly using the
RandomAccessStream and File classes. However,
RecordStoreFile served as the java/native code boundary for
RMS in the MIDP 1.0 release. It exists now for
backwards compatibility with older ports.
|
Method Summary | |
void | close() Disconnect from recordStream if it is
non null. | void | commitWrite() | int | read(byte[] buf) Read up to buf.length into buf .
Parameters: buf - buffer to read in to. | int | read(byte[] buf, int offset, int numBytes) Read up to buf.length into buf
starting at offset offset in recordStream
and continuing for up to numBytes bytes.
Parameters: buf - buffer to read in to. Parameters: offset - starting point read offset, from beginning of buffer. Parameters: numBytes - the number of bytes to read. | void | seek(int pos) Sets the position within recordStream to
pos . | int | spaceAvailable(int suiteId) Approximation of remaining space in storage. | void | truncate(int size) Sets the length of this RecordStoreFile
size bytes. | void | write(byte[] buf) Write all of buf to recordStream . | void | write(byte[] buf, int offset, int numBytes) Write buf to recordStream , starting
at offset and continuing for numBytes
bytes. |
DB_EXTENSION | final static int DB_EXTENSION(Code) | | extension for RecordStore database files
|
IDX_EXTENSION | final static int IDX_EXTENSION(Code) | | extension for RecordStore database files
|
close | void close() throws IOException(Code) | | Disconnect from recordStream if it is
non null. May be called more than once without error.
exception: IOException - if an error occurs closingrecordStream . |
commitWrite | void commitWrite() throws IOException(Code) | | Commit pending writes
exception: IOException - if an error occurs while flushingrecordStream . |
read | int read(byte[] buf) throws IOException(Code) | | Read up to buf.length into buf .
Parameters: buf - buffer to read in to. the number of bytes read. exception: IOException - if a read error occurs. |
read | int read(byte[] buf, int offset, int numBytes) throws IOException(Code) | | Read up to buf.length into buf
starting at offset offset in recordStream
and continuing for up to numBytes bytes.
Parameters: buf - buffer to read in to. Parameters: offset - starting point read offset, from beginning of buffer. Parameters: numBytes - the number of bytes to read. the number of bytes read. exception: IOException - if a read error occurs. |
seek | void seek(int pos) throws IOException(Code) | | Sets the position within recordStream to
pos . This will implicitly grow
the underlying stream if pos is made greater
than the current length of the storage stream.
Parameters: pos - position within the file to move the current_pospointer to. exception: IOException - if there is a problem with the seek. |
spaceAvailable | int spaceAvailable(int suiteId)(Code) | | Approximation of remaining space in storage.
Usage Warning: This may be a slow operation if
the platform has to look at the size of each file
stored in the MIDP memory space and include its size
in the total.
Parameters: suiteId - ID of the MIDlet suite that owns the record storecan be null the approximate space available to grow therecord store in bytes. |
truncate | void truncate(int size) throws IOException(Code) | | Sets the length of this RecordStoreFile
size bytes. If this file was previously
larger than size the extra data is lost.
size must be <= the current length of
recordStream
Parameters: size - new size for this file. exception: IOException - if an error occurs, or ifsize is less than zero. |
write | void write(byte[] buf) throws IOException(Code) | | Write all of buf to recordStream .
Parameters: buf - buffer to read out of. exception: IOException - if a write error occurs. |
write | void write(byte[] buf, int offset, int numBytes) throws IOException(Code) | | Write buf to recordStream , starting
at offset and continuing for numBytes
bytes.
Parameters: buf - buffer to read out of. Parameters: offset - starting point write offset, from beginning of buffer. Parameters: numBytes - the number of bytes to write. exception: IOException - if a write error occurs. |
|
|