Class COM.odi.util.OSTreeMapByteArray
java.lang.Object
|
+----COM.odi.util.OSTreeMap
|
+----COM.odi.util.OSTreeMapByteArray
- public class OSTreeMapByteArray
- extends OSTreeMap
OSTreeMapByteArray implements the COM.odi.util.Map interface with a
persistent B-tree. The keys are byte arrays, and the values are objects.
This class is included in PSE Pro, but not in PSE.
Additional information about OSTreeMapByteArray
is in the user guide.
Here are exceptions that might be thrown by many of the
methods in this class:
DatabaseNotOpenException
If the database containing the object is not open.
NoTransactionInProgressException
If there is no transaction in progress.
ObjectNotFoundException
If the object was not found, either because the object itself, its segment,
or its database was destroyed.
ObjectException
Ifthe object was local and was fetched in a previous transaction.
ObjectStoreException
If the session implied by an argument
to the call or the object the method is called on is not the same as
the session associated with the current thread.
UpdateReadOnlyException
If there is a readonly
transaction in progress or if the database is open for readonly.
-
OSTreeMapByteArray(Placement)
- Creates an OSTreeMapByteArray with variable
length keys.
-
OSTreeMapByteArray(Placement, int, boolean, boolean)
- Creates an OSTreeMapByteArray.
-
byteArrayToKey(byte[])
-
Decodes a byte array encoding of a key, and returns the corresponding
key.
-
containsKey(byte[])
- Returns true if this Map contains a mapping for the specified key.
-
get(byte[])
- Returns the value to which this Map maps the specified key.
-
keyToByteArray(Object, byte[])
-
Encodes a key into a byte array.
-
put(byte[], Object)
- Associates the specified value with the specified key in this Map
(optional operation).
-
remove(byte[])
- Removes the mapping for this key from this Map if present (optional
operation).
OSTreeMapByteArray
public OSTreeMapByteArray(Placement placement)
- Creates an OSTreeMapByteArray with variable
length keys. Note that the
database containing the placement needs to be open for update and
an update transaction needs to be in progress.
- Parameters:
- placement - The database or segment in which to create the OSTreeMap.
- Returns:
- The new OSTreeMap.
- Throws: NoTransactionInProgressException
- If no transaction is in
progress.
- Throws: ObjectStoreException
- If the current thread is not associated
with a session and there is no global session.
- Throws: UpdateReadOnlyException
- If there is a read-only transaction in
progress or if the database is open read-only.
OSTreeMapByteArray
public OSTreeMapByteArray(Placement placement,
int keySize,
boolean fixedSizeKeys,
boolean export)
- Creates an OSTreeMapByteArray. Note that the database containing
the placement needs to be open for update and an update
transaction needs to be in progress.
- Parameters:
- placement - The database or segment in which to create the OSTreeMap.
- keySize - The size of the key -- must be a number greater than 0. If
variable size keys are permitted, this is the size key which can be stored
without using overflow storage. Note that three combinations of key size
and key variability are handled specially to provide better efficiency: 4
and 8 byte fixed sized keys, and 28 byte variable sized keys.
- fixedSizeKeys - True specifies that keys will not be longer
than the specified key size, and that overflow storage is
therefore unnecessary. False indicates that keys may be larger
than the specified key size, in which case the remainder of the
key is stored in overflow storage.
- export - If true, create an exported object.
- Returns:
- The new OSTreeMap.
- Throws: NoTransactionInProgressException
- If no transaction is in
progress.
- Throws: ObjectStoreException
- If the current thread is not associated
with a session and there is no global session.
- Throws: UpdateReadOnlyException
- If there is a read-only transaction in
progress or if the database is open read-only.
containsKey
public boolean containsKey(byte key[])
- Returns true if this Map contains a mapping for the specified key.
- Parameters:
- key - key whose presence in this Map is to be tested.
get
public Object get(byte key[])
- Returns the value to which this Map maps the specified key.
Returns null if the Map contains no mapping for this key. A return
value of null does not necessarily indicate that the Map
contains no mapping for the key; it's also possible that the Map
explicitly maps the key to null. The containsKey operation may be
used to distinguish these two cases.
- Parameters:
- key - key whose associated value is to be returned.
put
public Object put(byte key[],
Object value)
- Associates the specified value with the specified key in this Map
(optional operation). If the Map previously contained a mapping for
this key, the old value is replaced.
- Parameters:
- key - key with which the specified value is to be associated.
- value - value to be associated with the specified key.
- Returns:
- previous value associated with specified key, or null if there
was no mapping for key. (A null return can also indicate that
the Map previously associated null with the specified key,
if the implementation supports null values.)
remove
public Object remove(byte key[])
- Removes the mapping for this key from this Map if present (optional
operation).
- Parameters:
- key - key whose mapping is to be removed from the Map.
- Returns:
- previous value associated with specified key, or null if there
was no mapping for key. (A null return can also indicate that
the Map previously associated null with the specified key,
if the implementation supports null values.)
keyToByteArray
public byte[] keyToByteArray(Object key,
byte buffer[])
- Encodes a key into a byte array.
- Parameters:
- key - key to be encoded.
- ignored - a byte[] to use as a buffer for the returned
encoding -- this is ignored, because the input key is itself
a byte[], which is returned directly.
- Overrides:
- keyToByteArray in class OSTreeMap
byteArrayToKey
public Object byteArrayToKey(byte key[])
- Decodes a byte array encoding of a key, and returns the corresponding
key. Since OSTreeMapByteArray keys are already byte arrays, this
method simply returns its argument (other subtypes of OSTreeMap must
perform a more substantive decoding).
- Overrides:
- byteArrayToKey in class OSTreeMap
Copyright © 1996, 1997, 1998 Object Design, Inc. All rights reserved.