public abstract class AbstractSlice<T> extends RocksMutableObject
Slice,
Regards the lifecycle of Java Slices in RocksDB:
At present when you configure a Comparator from Java, it creates an
instance of a C++ BaseComparatorJniCallback subclass and
passes that to RocksDB as the comparator. That subclass of
BaseComparatorJniCallback creates the Java,
subclass Objects. When you dispose
the Java @see org.rocksdb.AbstractComparator subclass, it disposes the
C++ BaseComparatorJniCallback subclass, which in turn destroys the
Java @see org.rocksdb.AbstractSlice subclass Objects.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSlice() |
protected |
AbstractSlice(long nativeHandle) |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
clear()
Clears the backing slice
|
int |
compare(AbstractSlice<?> other)
Three-way key comparison
|
protected static long |
createNewSliceFromString(String str) |
T |
data()
Returns the data of the slice.
|
protected abstract T |
data0(long handle)
Access to the data is provided by the
subtype as it needs to handle the
generic typing.
|
protected void |
disposeInternal(long handle)
Deletes underlying C++ slice pointer.
|
boolean |
empty()
Return true if the length of the
data is zero.
|
boolean |
equals(Object other)
If other is a slice object, then
we defer to
compare
to check equality, otherwise we return false. |
int |
hashCode() |
abstract void |
removePrefix(int n)
Drops the specified
n
number of bytes from the start
of the backing slice |
int |
size()
Return the length (in bytes) of the data.
|
boolean |
startsWith(AbstractSlice<?> prefix)
Determines whether this slice starts with
another slice
|
String |
toString() |
String |
toString(boolean hex)
Creates a string representation of the data
|
close, disposeInternal, getNativeHandle, isOwningHandle, resetNativeHandle, setNativeHandleprotected AbstractSlice()
protected AbstractSlice(long nativeHandle)
public T data()
data0(long)protected abstract T data0(long handle)
handle - The address of the underlying
native object.public abstract void removePrefix(int n)
n
number of bytes from the start
of the backing slicen - The number of bytes to droppublic abstract void clear()
public int size()
public boolean empty()
public String toString(boolean hex)
hex - When true, the representation
will be encoded in hexadecimal.public int compare(AbstractSlice<?> other)
other - A slice to compare againstpublic boolean equals(Object other)
compare
to check equality, otherwise we return false.public boolean startsWith(AbstractSlice<?> prefix)
prefix - Another slice which may of may not
be a prefix of this slice.prefix sliceprotected static long createNewSliceFromString(String str)
protected final void disposeInternal(long handle)
disposeInternal in class RocksMutableObjectCopyright © 2022. All rights reserved.