Documentation of 'org.mapdb.SerializerBase' Java class
SerializerBase
org.mapdb

Class SerializerBase

  • Direct Known Subclasses:
    SerializerPojo


    public class SerializerBase
    extends Serializer<java.lang.Object>
    Serializer which uses 'header byte' to serialize/deserialize most of classes from 'java.lang' and 'java.util' packages.
    • Constructor Detail

      • SerializerBase

        public SerializerBase()
    • Method Detail

      • serializeObjectArray

        public void serializeObjectArray(java.io.DataOutput out,
                                         java.lang.Object[] b,
                                         org.mapdb.SerializerBase.FastArrayList objectStack)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • serialize

        public void serialize(java.io.DataOutput out,
                              java.lang.Object obj)
                       throws java.io.IOException
        Description copied from class: Serializer
        Serialize the content of an object into a ObjectOutput
        Specified by:
        serialize in class Serializer<java.lang.Object>
        Parameters:
        out - ObjectOutput to save object into
        obj - Object to serialize
        Throws:
        java.io.IOException - in case of IO error
      • serialize

        public void serialize(java.io.DataOutput out,
                              java.lang.Object obj,
                              org.mapdb.SerializerBase.FastArrayList<java.lang.Object> objectStack)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • deserialize

        public java.lang.Object deserialize(java.io.DataInput in,
                                            int capacity)
                                     throws java.io.IOException
        Description copied from class: Serializer
        Deserialize the content of an object from a DataInput.
        Specified by:
        deserialize in class Serializer<java.lang.Object>
        Parameters:
        in - to read serialized data from
        capacity - how many bytes are available in DataInput for reading, may be -1 (in streams) or 0 (null).
        Returns:
        deserialized object
        Throws:
        java.io.IOException - in case of IO error
      • deserialize

        public java.lang.Object deserialize(java.io.DataInput in,
                                            org.mapdb.SerializerBase.FastArrayList<java.lang.Object> objectStack)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • assertSerializable

        public void assertSerializable(java.lang.Object o)
      • isTrusted

        public boolean isTrusted()
        Description copied from class: Serializer

        MapDB has relax record size boundary checking. It expect deserializer to read exactly as many bytes as were writen during serialization. If deserializer reads more bytes 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 store, but must copy them into separate byte[]. So zero copy optimalizations is disabled by default, and must be explicitly enabled here.

        This flag indicates if this serializer was 'verified' to read as many bytes as it writes. It should be also much better tested etc.

        Overrides:
        isTrusted in class Serializer<java.lang.Object>
        Returns:
        true if this serializer is well tested and writes as many bytes as it reads.
      • isSerializable

        public boolean isSerializable(java.lang.Object o)
        return true if mapdb knows howto serialize given object
      • equalsBinary

        public boolean equalsBinary(java.lang.Object a1,
                                    java.lang.Object a2)
        Tries to serialize two object and return true if they are binary equal
        Parameters:
        a1 - first object
        a2 - second object
        Returns:
        true if objects are equal or binary equal, false if not equal or some failure happend

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.