|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object qdbm.Curia
public class Curia
The Java API of Curia, the extended API of QDBM. This class depends on the native library `jqdbm'.
Field Summary | |
---|---|
static int |
DCAT
write mode: concatenate values |
static int |
DKEEP
write mode: keep the existing value |
static int |
DOVER
write mode: overwrite the existing value |
static int |
EALLOC
error code: memory allocation error |
static int |
EBROKEN
error code: broken database file |
static int |
ECLOSE
error code: close error |
static int |
EFATAL
error code: with fatal error |
static int |
EKEEP
error code: existing record |
static int |
ELOCK
error code: lock error |
static int |
EMAP
error code: memory mapping error |
static int |
EMISC
error code: miscellaneous error |
static int |
EMKDIR
error code: mkdir error |
static int |
EMODE
error code: invalid mode |
static int |
ENOERR
error code: no error |
static int |
ENOITEM
error code: no item found |
static int |
EOPEN
error code: open error |
static int |
EREAD
error code: read error |
static int |
ERMDIR
error code: rmdir error |
static int |
ESEEK
error code: seek error |
static int |
ESTAT
error code: stat error |
static int |
ESYNC
error code: sync error |
static int |
ETRUNC
error code: trunc error |
static int |
EUNLINK
error code: unlink error |
static int |
EWRITE
error code: write error |
static int |
OCREAT
open mode: writer creating |
static int |
OLCKNB
open mode: lock without blocking |
static int |
ONOLCK
open mode: open without locking |
static int |
OREADER
open mode: open as a reader |
static int |
OSPARSE
open mode: create as sparse files |
static int |
OTRUNC
open mode: writer truncating |
static int |
OWRITER
open mode: open as a writer |
boolean |
silent
Whether to repress frequent exceptions. |
Constructor Summary | |
---|---|
Curia(java.lang.String name)
Get the database handle as a reader. |
|
Curia(java.lang.String name,
int omode,
int bnum,
int dnum)
Get the database handle. |
Method Summary | |
---|---|
int |
bnum()
Get the total number of the elements of each bucket array. |
int |
busenum()
Get the total number of the used elements of each bucket array. |
void |
close()
Close the database handle. |
void |
delete(byte[] key)
Delete a record. |
static java.lang.String |
errmsg(int ecode)
Get an error message. |
boolean |
error()
Check whether a fatal error occured or not. |
boolean |
fatalerror()
Check whether the database has a fatal error or not. |
byte[] |
fetch(byte[] key)
Fetch a record. |
protected void |
finalize()
Release the resources. |
byte[] |
firstkey()
Get the first key. |
long |
fsiz()
Get the total size of the database files. |
byte[] |
get(byte[] key)
Retrieve whole value of a record. |
byte[] |
get(byte[] key,
int start,
int max)
Retrieve a record. |
byte[] |
getlob(byte[] key)
Retrieve whole value of a large object. |
byte[] |
getlob(byte[] key,
int start,
int max)
Retrieve a large object. |
int |
inode()
Get the inode number of the database. |
void |
iterinit()
Initialize the iterator of the database handle. |
byte[] |
iternext()
Get the next key of the iterator. |
long |
mtime()
Get the last modified time of the database. |
java.lang.String |
name()
Get the name of the database. |
byte[] |
nextkey()
Get the next key. |
void |
optimize(int bnum)
Optimize the database. |
boolean |
out(byte[] key)
Delete a record. |
boolean |
outlob(byte[] key)
Delete a large object. |
boolean |
put(byte[] key,
byte[] val)
Store a record with overwrite. |
boolean |
put(byte[] key,
byte[] val,
int dmode)
Store a record. |
boolean |
putlob(byte[] key,
byte[] val)
Store a large object with overwrite. |
boolean |
putlob(byte[] key,
byte[] val,
int dmode)
Store a large object. |
static void |
remove(java.lang.String name)
Remove a database directory. |
int |
rnum()
Get the number of the records stored in the database. |
int |
rnumlob()
Get the number of the large objects stored in the database. |
void |
setalign(int align)
Set alignment of the database handle. |
void |
setfbpsiz(int size)
Set the size of the free block pool. |
static byte[] |
snaffle(java.lang.String name,
byte[] key)
Retrieve a record directly from a database directory. |
void |
store(byte[] key,
byte[] val,
boolean replace)
Store a record. |
void |
sync()
Synchronize updating contents with the files and the devices. |
static java.lang.String |
version()
Get the version information. |
int |
vsiz(byte[] key)
Get the size of the value of a record. |
int |
vsizlob(byte[] key)
Get the size of the value of a large object. |
boolean |
writable()
Check whether the database handle is a writer or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DCAT
public static final int DKEEP
public static final int DOVER
public static final int EALLOC
public static final int EBROKEN
public static final int ECLOSE
public static final int EFATAL
public static final int EKEEP
public static final int ELOCK
public static final int EMAP
public static final int EMISC
public static final int EMKDIR
public static final int EMODE
public static final int ENOERR
public static final int ENOITEM
public static final int EOPEN
public static final int EREAD
public static final int ERMDIR
public static final int ESEEK
public static final int ESTAT
public static final int ESYNC
public static final int ETRUNC
public static final int EUNLINK
public static final int EWRITE
public static final int OCREAT
public static final int OLCKNB
public static final int ONOLCK
public static final int OREADER
public static final int OSPARSE
public static final int OTRUNC
public static final int OWRITER
public boolean silent
Constructor Detail |
---|
public Curia(java.lang.String name) throws CuriaException
CuriaException
Curia(java.lang.String, int, int, int)
public Curia(java.lang.String name, int omode, int bnum, int dnum) throws CuriaException
name
- the name of a database directory.omode
- the connection mode: `Curia.OWRITER' as a writer, `Curia.OREADER' as
a reader. If the mode is `Curia.OWRITER', the following may be added by bitwise or:
`Curia.OCREAT', which means it creates a new database if not exist, `Curia.OTRUNC',
which means it creates a new database regardless if one exists. Both of `Curia.OREADER'
and `Curia.OWRITER' can be added to by bitwise or: `Curia.ONOLCK', which means it opens a
database directory without file locking, or `Curia.OLCKNB', which means locking is performed
without blocking. `Curia.OCREAT' can be added to by bitwise or: `Curia.OSPARSE', which
means it creates database files as sparse files.bnum
- the number of elements of the each bucket array. If it is not more than 0,
the default value is specified. The size of each bucket array is determined on creating,
and can not be changed except for by optimization of the database. Suggested size of each
bucket array is about from 0.5 to 4 times of the number of all records to store.dnum
- the number of division of the database. If it is not more than 0, the default
value is specified. The number of division can not be changed from the initial value. The
max number of division is 512.
CuriaException
- if an error occurs.Method Detail |
---|
public int bnum() throws CuriaException
CuriaException
- if an error occurs.public int busenum() throws CuriaException
CuriaException
- if an error occurs.public void close() throws CuriaException
close
in interface ADBM
CuriaException
- if an error occurs.public void delete(byte[] key) throws CuriaException
delete
in interface ADBM
key
- a byte array of a key.
CuriaException
- if an error occurs or no record corresponds.public static java.lang.String errmsg(int ecode)
ecode
- an error code.
public boolean error() throws CuriaException
error
in interface ADBM
CuriaException
- if an error occurs.public boolean fatalerror() throws CuriaException
CuriaException
- if an error occurs.public byte[] fetch(byte[] key) throws CuriaException
fetch
in interface ADBM
key
- a byte array of a key.
CuriaException
- if an error occurs or no record corresponds.protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public byte[] firstkey() throws CuriaException
firstkey
in interface ADBM
CuriaException
- if an error occurs or no record corresponds.public long fsiz() throws CuriaException
CuriaException
- if an error occurs.public byte[] get(byte[] key) throws CuriaException
CuriaException
get(byte[], int, int)
public byte[] get(byte[] key, int start, int max) throws CuriaException
key
- a byte array of a key.start
- the array index of the beginning of the value to be read.max
- the max size to read with. If it is negative, the size is unlimited.
CuriaException
- if an error occurs, no record corresponds, or the size of the value
of the corresponding record is less than the index specified by the parameter `start'.public byte[] getlob(byte[] key) throws CuriaException
CuriaException
get(byte[], int, int)
public byte[] getlob(byte[] key, int start, int max) throws CuriaException
key
- a byte array of a key.start
- the array index of the beginning of the value to be read.max
- the max size to be read. If it is negative, the size to read is unlimited.
CuriaException
- if an error occurs, no large object corresponds or the size of the
value of the corresponding is less than the index specified by the parameter `start'.public int inode() throws CuriaException
CuriaException
- if an error occurs.public void iterinit() throws CuriaException
CuriaException
- if an error occurs.public byte[] iternext() throws CuriaException
CuriaException
- if an error occurs or no record corresponds.public long mtime() throws CuriaException
CuriaException
- if an error occurs.public java.lang.String name() throws CuriaException
CuriaException
- if an error occurs.public byte[] nextkey() throws CuriaException
nextkey
in interface ADBM
CuriaException
- if an error occurs or no record corresponds.public void optimize(int bnum) throws CuriaException
bnum
- the number of the elements of each bucket array. If it is not more than 0, the
default value is specified.
CuriaException
- if an error occurs.public boolean out(byte[] key) throws CuriaException
key
- a byte array of a key.
CuriaException
- if an error occurs or no record corresponds.public boolean outlob(byte[] key) throws CuriaException
key
- a byte array of a key.
CuriaException
- if an error occurs or no large object corresponds.public boolean put(byte[] key, byte[] val) throws CuriaException
CuriaException
put(byte[], byte[], int)
public boolean put(byte[] key, byte[] val, int dmode) throws CuriaException
key
- a byte array of a key.val
- a byte array of a value.dmode
- behavior when the key overlaps, by the following values: `Curia.DOVER',
which means the specified value overwrites the existing one, `Curia.DKEEP', which means the
existing value is kept, `Curia.DCAT', which means the specified value is concatenated at
the end of the existing value.
CuriaException
- if an error occurs or replace is cancelled.public boolean putlob(byte[] key, byte[] val) throws CuriaException
CuriaException
put(byte[], byte[], int)
public boolean putlob(byte[] key, byte[] val, int dmode) throws CuriaException
key
- a byte array of a key.val
- a byte array of a value.dmode
- behavior when the key overlaps, by the following values: `Curia.DOVER',
which means the specified value overwrites the existing one, `Curia.DKEEP', which means the
existing value is kept, `Curia.DCAT', which means the specified value is concatenated at
the end of the existing value.
CuriaException
- if an error occurs or replace is cancelled.public static void remove(java.lang.String name) throws CuriaException
name
- the name of a database directory.
CuriaException
- if an error occurs.public int rnum() throws CuriaException
CuriaException
- if an error occurs.public int rnumlob() throws CuriaException
CuriaException
- if an error occurs.public void setalign(int align) throws CuriaException
align
- the basic size of alignment.
CuriaException
- if an error occurs.public void setfbpsiz(int size) throws CuriaException
size
- the size of the free block pool of a database.
CuriaException
- if an error occurs.public static byte[] snaffle(java.lang.String name, byte[] key) throws CuriaException
name
- the name of a database directory.key
- a byte array of a key.
CuriaException
- if an error occurs or no record corresponds.public void store(byte[] key, byte[] val, boolean replace) throws CuriaException
store
in interface ADBM
key
- a byte array of a key.val
- a byte array of a value.replace
- whether the existing value is to be overwritten or not.
CuriaException
- if an error occurs or replace is cancelled.public void sync() throws CuriaException
CuriaException
- if an error occurs.public static java.lang.String version()
public int vsiz(byte[] key) throws CuriaException
key
- a byte array of a key.
CuriaException
- if an error occurs or no record corresponds.public int vsizlob(byte[] key) throws CuriaException
key
- a byte array of a key.
CuriaException
- if an error occurs or no large object corresponds.public boolean writable() throws CuriaException
CuriaException
- if an error occurs.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |