public class SerializerStringOrigHash extends SerializerString
BIG_DECIMAL, BIG_INTEGER, BOOLEAN, BYTE, BYTE_ARRAY, BYTE_ARRAY_DELTA, BYTE_ARRAY_DELTA2, BYTE_ARRAY_NOSIZE, CHAR, CHAR_ARRAY, CLASS, DATE, DOUBLE, DOUBLE_ARRAY, ELSA, FLOAT, FLOAT_ARRAY, ILLEGAL_ACCESS, INT_ARRAY, INTEGER, INTEGER_DELTA, INTEGER_PACKED, JAVA, LONG, LONG_ARRAY, LONG_DELTA, LONG_PACKED, RECID, RECID_ARRAY, SHORT, SHORT_ARRAY, STRING, STRING_ASCII, STRING_DELTA, STRING_DELTA2, STRING_INTERN, STRING_NOSIZE, STRING_ORIGHASH, UUID
Constructor and Description |
---|
SerializerStringOrigHash() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
deserialize(DataInput2 in,
int available)
Deserializes and returns the content of the given
DataInput2 . |
int |
hashCode(java.lang.String s,
int seed)
Returns a hash code of a given non-null argument.
|
boolean |
isTrusted()
Returns if this Serializer is trusted to always read the same number of
bytes as it writes for any given object being serialized/de-serialized.
|
void |
serialize(DataOutput2 out,
java.lang.String value)
Serializes the content of the given value into the given
DataOutput2 . |
valueArrayCopyOfRange, valueArrayDeleteValue, valueArrayDeserialize, valueArrayEmpty, valueArrayFromArray, valueArrayGet, valueArrayPut, valueArraySearch, valueArraySearch, valueArraySerialize, valueArraySize, valueArrayUpdateVal
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
nextValue, valueArrayBinaryGet, valueArrayBinarySearch, valueArrayToArray
clone, compare, deserializeFromLong, equals, fixedSize, needsAvailableSizeHint
public void serialize(DataOutput2 out, java.lang.String value) throws java.io.IOException
Serializer
DataOutput2
.serialize
in interface Serializer<java.lang.String>
serialize
in class SerializerString
out
- DataOutput2 to save object intovalue
- Object to serializejava.io.IOException
- in case of an I/O errorpublic java.lang.String deserialize(DataInput2 in, int available) throws java.io.IOException
Serializer
DataInput2
.deserialize
in interface Serializer<java.lang.String>
deserialize
in class SerializerString
in
- DataInput2 to de-serialize data fromavailable
- how many bytes that are available in the DataInput2 for
reading, may be -1 (in streams) or 0 (null).DataInput2
java.io.IOException
- in case of an I/O errorpublic boolean isTrusted()
Serializer
MapDB has a relaxed record size boundary checking. It expects deserializers to read exactly as many bytes as were written during serialization. If a deserializer reads more bytes than it wrote, it might start reading others record data in store.
Some serializers (Kryo) have problems with this. To prevent this, we can
not read data directly from a store, but we must copy them into separate
byte[]
buffers. Thus, zero-copy optimizations are disabled by
default, but can be explicitly enabled here by letting this method return
true
.
This flag indicates if this serializer was 'verified' to read as many bytes as it writes. It should also be much better tested etc.
isTrusted
in interface Serializer<java.lang.String>
isTrusted
in class SerializerString
public int hashCode(@NotNull java.lang.String s, int seed)
Serializer
hashCode
in interface Serializer<java.lang.String>
hashCode
in class SerializerString
s
- an objectseed
- used to "scramble" theObject.hashCode()
Copyright © 2018. All Rights Reserved.