ch.aplu.gidlet
Class StringStore

java.lang.Object
  extended by ch.aplu.gidlet.StringStore

public class StringStore
extends java.lang.Object

Wrapper class for MIDlet's RMS (record managing system) based on class RecordStore for storing strings exclusively.
A record store belongs to the "MIDlet suite" identified by the MIDlet-name and the MIDlet-vendor as defined in the application descriptor (JAD file). It has a record store name that must be unique within the MIDlet suite.


Constructor Summary
StringStore(java.lang.String storeName)
          Creates a StringStore instance with given record store name.
 
Method Summary
 boolean append(java.lang.String s)
          Appends string data to the end of the record store.
 boolean delete()
          Deletes record store.
 boolean exists()
          Checks if the record store exists.
 int getAvailableSpace()
          Returns amount of additional room available for record store to grow.
 int getUsedSpace()
          Returns amount of space, that the record store occupies.
 java.lang.String read()
          Returns content of the StringStore.
 boolean write(java.lang.String s)
          Writes string data the record store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringStore

public StringStore(java.lang.String storeName)
Creates a StringStore instance with given record store name. Record store names are case sensitive and may consist of any combination of between one and 32 Unicode characters inclusive.

No attempt is made to open the record store.

Method Detail

read

public java.lang.String read()
Returns content of the StringStore.

Returns:
content as string, null if the record store does not exist.

append

public boolean append(java.lang.String s)
Appends string data to the end of the record store. If the record store does not exist, it will be created. The record store is closed when finishing.

Returns:
true, if successful, false if operation fails

write

public boolean write(java.lang.String s)
Writes string data the record store. If the record store exists, all data is cleared. If the record store does not exist, it will be created. The record store is closed when finishing.

Returns:
true, if successful, false if operation fails

delete

public boolean delete()
Deletes record store. Only an owner MIDlet may perform this operation (same MIDlet-name and vendor-name in the application descriptor).

Returns:
true, if successful, false if operation fails

exists

public boolean exists()
Checks if the record store exists.

Returns:
true, if record store exists, false otherwise.

getAvailableSpace

public int getAvailableSpace()
Returns amount of additional room available for record store to grow.

Returns:
free space (in bytes), -1 if record store does not exist

getUsedSpace

public int getUsedSpace()
Returns amount of space, that the record store occupies.

Returns:
used space (in bytes), -1 if record store does not exist