qdbm
Class VillaCursor

java.lang.Object
  extended by qdbm.VillaCursor

public class VillaCursor
extends java.lang.Object

The Java API of cursor functions of Villa This class depends on the native library `jqdbm'.


Method Summary
protected  void finalize()
          Release resources.
 boolean first()
          Move the multiple cursor to the first record.
 boolean jump(byte[] key)
          Move the multiple cursor to a position around a record for stepping forward.
 boolean jump(byte[] key, int jmode)
          Move the multiple cursor to a position around a record.
 boolean jumpobj(java.lang.Object key, int jmode)
          Move the multiple cursor to a position around a record composed of serializable objects.
 byte[] key()
          Get the key of the record where the multiple cursor is.
 java.lang.Object keyobj()
          Get the key of the record composed of serializable objects, where the multiple cursor is.
 boolean last()
          Move the multiple cursor to the last record.
 boolean next()
          Move the multiple cursor to the next record.
 boolean prev()
          Move the multiple cursor to the next record.
 byte[] val()
          Get the value of the record where the multiple cursor is.
 java.lang.Object valobj()
          Get the value of the record where the multiple cursor is.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

finalize

protected void finalize()
Release resources.

Overrides:
finalize in class java.lang.Object

first

public boolean first()
              throws VillaException
Move the multiple cursor to the first record.

Returns:
always true. However, if the silent flag is true and no record corresponds, false is returned instead of exception.
Throws:
VillaException - if an error occurs or there is no record in the database.

jump

public boolean jump(byte[] key)
             throws VillaException
Move the multiple cursor to a position around a record for stepping forward. The same as `jump(key, Villa.JFORFARD)'.

Throws:
VillaException
See Also:
jump(byte[], int)

jump

public boolean jump(byte[] key,
                    int jmode)
             throws VillaException
Move the multiple cursor to a position around a record.

Parameters:
key - a byte array of a key.
jmode - detail adjustment: `Villa.JFORWARD', which means that the cursor is set to the first record of the same key and that the cursor is set to the next substitute if completely matching record does not exist, `Villa.JBACKWARD', which means that the cursor is set to the last record of the same key and that the cursor is set to the previous substitute if completely matching record does not exist.
Returns:
always true. However, if the silent flag is true and no record corresponds, false is returned instead of exception.
Throws:
VillaException - if an error occurs or there is no record corresponding the condition.

jumpobj

public boolean jumpobj(java.lang.Object key,
                       int jmode)
                throws VillaException
Move the multiple cursor to a position around a record composed of serializable objects. The same as `jump(qdbm.Util.serialize(key), jmode)'.

Throws:
VillaException
See Also:
jump(byte[], int)
Note:
If serialization is failed, an instance of `VillaException' is thrown.

key

public byte[] key()
           throws VillaException
Get the key of the record where the multiple cursor is.

Returns:
a byte array of the key of the corresponding record. If the silent flag is true and no record corresponds, `null' is returned instead of exception.
Throws:
VillaException - if an error occurs or no record corresponds to the cursor.

keyobj

public java.lang.Object keyobj()
                        throws VillaException
Get the key of the record composed of serializable objects, where the multiple cursor is. The same as `qdbm.Util.deserialize(key())'.

Throws:
VillaException
See Also:
key()
Note:
If serialization is failed, an instance of `VillaException' is thrown.

last

public boolean last()
             throws VillaException
Move the multiple cursor to the last record.

Returns:
always true. However, if the silent flag is true and no record corresponds, false is returned instead of exception.
Throws:
VillaException - if an error occurs or there is no record in the database.

next

public boolean next()
             throws VillaException
Move the multiple cursor to the next record.

Returns:
always true. However, if the silent flag is true and no record corresponds, false is returned instead of exception.
Throws:
VillaException - if an error occurs or there is no next record.

prev

public boolean prev()
             throws VillaException
Move the multiple cursor to the next record.

Returns:
always true. However, if the silent flag is true and no record corresponds, false is returned instead of exception.
Throws:
VillaException - if an error occurs or there is no previous record.

val

public byte[] val()
           throws VillaException
Get the value of the record where the multiple cursor is.

Returns:
a byte array of the value of the corresponding record. If the silent flag is true and no record corresponds, `null' is returned instead of exception.
Throws:
VillaException - if an error occurs or no record corresponds to the cursor.

valobj

public java.lang.Object valobj()
                        throws VillaException
Get the value of the record where the multiple cursor is. The same as `qdbm.Util.deserialize(val())'.

Throws:
VillaException
See Also:
val()
Note:
If serialization is failed, an instance of `VillaException' is thrown.