public class SerializerArray<T> extends GroupSerializerObjectArray<T[]>
Array.newInstance(Class, int)
Modifier and Type | Field and Description |
---|---|
protected java.lang.Class<T> |
componentType |
protected Serializer<T> |
serializer |
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 |
---|
SerializerArray(Serializer<T> serializer)
Wraps given serializer and produces Object[] serializer.
|
SerializerArray(Serializer<T> serializer,
java.lang.Class<T> componentType)
Wraps given serializer and produces array serializer.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(java.lang.Object[] o1,
java.lang.Object[] o2) |
T[] |
deserialize(DataInput2 in,
int available)
Deserializes and returns the content of the given
DataInput2 . |
boolean |
equals(java.lang.Object o) |
boolean |
equals(T[] a1,
T[] a2)
Returns if the first and second arguments are equal to each other.
|
int |
hashCode() |
int |
hashCode(T[] objects,
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,
T[] value)
Serializes the content of the given value into the given
DataOutput2 . |
valueArrayCopyOfRange, valueArrayDeleteValue, valueArrayDeserialize, valueArrayEmpty, valueArrayFromArray, valueArrayGet, valueArrayPut, valueArraySearch, valueArraySearch, valueArraySerialize, valueArraySize, valueArrayToArray, valueArrayUpdateVal
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
nextValue, valueArrayBinaryGet, valueArrayBinarySearch
clone, deserializeFromLong, fixedSize, needsAvailableSizeHint
protected final Serializer<T> serializer
protected final java.lang.Class<T> componentType
public SerializerArray(Serializer<T> serializer)
public SerializerArray(Serializer<T> serializer, java.lang.Class<T> componentType)
serializer
- componentType
- type of array which will be created on deserializationpublic void serialize(DataOutput2 out, T[] value) throws java.io.IOException
Serializer
DataOutput2
.out
- DataOutput2 to save object intovalue
- Object to serializejava.io.IOException
- in case of an I/O errorpublic T[] deserialize(DataInput2 in, int available) throws java.io.IOException
Serializer
DataInput2
.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.
public boolean equals(T[] a1, T[] a2)
Serializer
null
, true
is
returned and if exactly one argument is null
, false
is
returned.a1
- an objecta2
- another object to be compared with the first object for
equalityObject.equals(Object)
public int hashCode(T[] objects, int seed)
Serializer
objects
- an objectseed
- used to "scramble" theObject.hashCode()
public boolean equals(java.lang.Object o)
equals
in interface java.util.Comparator<T[]>
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compare(java.lang.Object[] o1, java.lang.Object[] o2)
Copyright © 2018. All Rights Reserved.