Package tkrzw
Class Iterator
Object
Iterator
Iterator for each record.
- Note:
- An iterator is made by the "makeIterator" method of DBM. Every unused iterator object should be destructed explicitly by the "destruct" method to free resources.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destruct()
Destructs the object and releases resources.first()
Initializes the iterator to indicate the first record.byte[][]
get()
Gets the key and the value of the current record of the iterator, witout status assingment.byte[][]
Gets the key and the value of the current record of the iterator.byte[]
getKey()
Gets the key of the current record.Gets the key of the current record, as string data.String[]
Gets the key and the value of the current record, as string data, without status assignemnt.String[]
Gets the key and the value of the current record, as string data.byte[]
getValue()
Gets the key of the current record.Gets the key of the current record, as string data.jump
(byte[] key) Initializes the iterator to indicate a specific record.Initializes the iterator to indicate a specific record, with string data.jumpLower
(byte[] key, boolean inclusive) Initializes the iterator to indicate the last record whose key is lower than a given key.Initializes the iterator to indicate the last record whose key is lower, with string data.jumpUpper
(byte[] key, boolean inclusive) Initializes the iterator to indicate the first record whose key is upper than a given key.Initializes the iterator to indicate the first record whose key is upper, with string data.last()
Initializes the iterator to indicate the last record.next()
Moves the iterator to the next record.previous()
Moves the iterator to the previous record.remove()
Removes the current record.set
(byte[] value) Sets the value of the current record.Sets the value of the current record, with string data.byte[][]
step()
Gets the current record and moves the iterator to the next record, witout status assingment.byte[][]
Gets the current record and moves the iterator to the next record.String[]
Gets the current record and moves the iterator to the next record, as string data.String[]
stepString
(Status status) Gets the current record and moves the iterator to the next record, as string data.toString()
Gets a string representation of the iterator.
-
Method Details
-
destruct
public void destruct()Destructs the object and releases resources. -
first
Initializes the iterator to indicate the first record.- Returns:
- The result status.
- Note:
- Even if there's no record, the operation doesn't fail.
-
last
Initializes the iterator to indicate the last record.- Returns:
- The result status.
- Note:
- Even if there's no record, the operation doesn't fail. This method is suppoerted only by ordered databases.
-
jump
Initializes the iterator to indicate a specific record.- Parameters:
key
- The key of the record to look for.- Returns:
- The result status.
- Note:
- Ordered databases can support "lower bound" jump; If there's no record with the same key, the iterator refers to the first record whose key is greater than the given key. The operation fails with unordered databases if there's no record with the same key.
-
jump
Initializes the iterator to indicate a specific record, with string data.- Parameters:
key
- The key of the record to look for.- Returns:
- The result status.
- Note:
- Ordered databases can support "lower bound" jump; If there's no record with the same key, the iterator refers to the first record whose key is greater than the given key. The operation fails with unordered databases if there's no record with the same key.
-
jumpLower
Initializes the iterator to indicate the last record whose key is lower than a given key.- Parameters:
key
- The key to compare with.inclusive
- If true, the considtion is inclusive: equal to or lower than the key.- Returns:
- The result status.
- Note:
- Even if there's no matching record, the operation doesn't fail. This method is suppoerted only by ordered databases.
-
jumpLower
Initializes the iterator to indicate the last record whose key is lower, with string data.- Parameters:
key
- The key to compare with.inclusive
- If true, the considtion is inclusive: equal to or lower than the key.- Returns:
- The result status.
- Note:
- Even if there's no matching record, the operation doesn't fail. This method is suppoerted only by ordered databases.
-
jumpUpper
Initializes the iterator to indicate the first record whose key is upper than a given key.- Parameters:
key
- The key to compare with.inclusive
- If true, the considtion is inclusive: equal to or upper than the key.- Returns:
- The result status.
- Note:
- Even if there's no matching record, the operation doesn't fail. This method is suppoerted only by ordered databases.
-
jumpUpper
Initializes the iterator to indicate the first record whose key is upper, with string data.- Parameters:
key
- The key to compare with.inclusive
- If true, the considtion is inclusive: equal to or upper than the key.- Returns:
- The result status.
- Note:
- Even if there's no matching record, the operation doesn't fail. This method is suppoerted only by ordered databases.
-
next
Moves the iterator to the next record.- Returns:
- The result status.
- Note:
- If the current record is missing, the operation fails. Even if there's no next record, the operation doesn't fail.
-
previous
Moves the iterator to the previous record.- Returns:
- The result status.
- Note:
- If the current record is missing, the operation fails. Even if there's no previous record, the operation doesn't fail. This method is suppoerted only by ordered databases.
-
get
Gets the key and the value of the current record of the iterator.- Parameters:
status
- The status object to store the result status. If it is null, it is ignored.- Returns:
- A pair of the key and the value of the current record, or null on failure.
-
get
public byte[][] get()Gets the key and the value of the current record of the iterator, witout status assingment.- Returns:
- A pair of the key and the value of the current record, or null on failure.
-
getString
Gets the key and the value of the current record, as string data.- Parameters:
status
- The status object to store the result status. If it is null, it is ignored.- Returns:
- A pair of the key and the value of the current record, or null on failure.
-
getString
Gets the key and the value of the current record, as string data, without status assignemnt.- Returns:
- A pair of the key and the value of the current record, or null on failure.
-
getKey
public byte[] getKey()Gets the key of the current record.- Returns:
- The key of the current record, or null on failure.
-
getKeyString
Gets the key of the current record, as string data.- Returns:
- The key of the current record, or null on failure.
-
getValue
public byte[] getValue()Gets the key of the current record.- Returns:
- The key of the current record, or null on failure.
-
getValueString
Gets the key of the current record, as string data.- Returns:
- The key of the current record, or null on failure.
-
set
Sets the value of the current record.- Parameters:
value
- The value of the record.- Returns:
- The result status.
-
set
Sets the value of the current record, with string data.- Parameters:
value
- The value of the record.- Returns:
- The result status.
-
remove
Removes the current record.- Returns:
- The result status.
- Note:
- If possible, the iterator moves to the next record.
-
step
Gets the current record and moves the iterator to the next record.- Parameters:
status
- The status object to store the result status. If it is null, it is ignored.- Returns:
- A pair of the key and the value of the current record, or null on failure.
-
step
public byte[][] step()Gets the current record and moves the iterator to the next record, witout status assingment.- Returns:
- A pair of the key and the value of the current record, or null on failure.
-
stepString
Gets the current record and moves the iterator to the next record, as string data.- Parameters:
status
- The status object to store the result status. If it is null, it is ignored.- Returns:
- A pair of the key and the value of the current record, or null on failure.
-
stepString
Gets the current record and moves the iterator to the next record, as string data.- Returns:
- A pair of the key and the value of the current record, or null on failure.
-
toString
Gets a string representation of the iterator.
-