Class Serializer

java.lang.Object
com.pnfsoftware.jeb.util.serialization.Serializer
All Implemented Interfaces:
IInternalSerializer

public class Serializer extends Object implements IInternalSerializer
This class allows the serialization of object(s) to a stream of bytes.

The serialize(Object) method is interruptible.

  • Field Details

    • dbgObjectCounts

      public ReferenceCounter<String> dbgObjectCounts
    • dbgObjectStores

      public Map<String,List<Object>> dbgObjectStores
    • dbgTypeIds

      public Set<Integer> dbgTypeIds
    • writtenStringCount

      public int writtenStringCount
    • writtenStringBytesCount

      public long writtenStringBytesCount
    • writtenStringPool

      public Set<String> writtenStringPool
    • collectionSizes

      public ReferenceCounter<Integer> collectionSizes
    • deferredCount

      public int deferredCount
  • Constructor Details

  • Method Details

    • setup

      public void setup(boolean simulation)
    • getStream

      public OutputStream getStream()
      Specified by:
      getStream in interface IInternalSerializer
    • getRootCount

      public int getRootCount()
    • getObjectCount

      public int getObjectCount()
      Retrieve the number of serialized or partially serialized objects.

      CAREFUL! the number of objects fully serialized (entirely written to the stream) is less than or equal to that number. Use getWrittenObjectCount() to get it.

      Returns:
    • getWrittenObjectCount

      public int getWrittenObjectCount()
    • getLastWrittenSize

      public long getLastWrittenSize()
      Retrieve the number of bytes (may be approximate) generated by the last call made to serialize(Object).
      Returns:
      a number of bytes, possibly an approximation if the last call to serialize(Object) was made in simulation mode
    • getStringPool

      public List<String> getStringPool()
    • serialize

      public void serialize(Object root) throws IOException
      Throws:
      IOException
    • close

      public void close() throws IOException
      Throws:
      IOException
    • write

      public void write(Object o) throws IOException
      Specified by:
      write in interface IInternalSerializer
      Throws:
      IOException
    • writeFields

      public void writeFields(Object o, Class<?> targetClass) throws IOException
      Specified by:
      writeFields in interface IInternalSerializer
      Throws:
      IOException
    • setExpectedObjectCount

      public void setExpectedObjectCount(int count)
    • addProgressCallback

      public void addProgressCallback(IProgressCallback callback)
    • removeProgressCallback

      public void removeProgressCallback(IProgressCallback callback)
    • setCustomSerializationClassFlags

      public void setCustomSerializationClassFlags(Class<?> c, int flags)
    • debugEnable

      public void debugEnable(boolean enableObjectCounting, boolean enableObjectStoring, boolean enableTypeIdStoring)
    • debugGetObjectCounts

      public ReferenceCounter<String> debugGetObjectCounts()
    • debugGetObjectStores

      public Map<String,List<Object>> debugGetObjectStores()
    • debugGetObjectStores

      public <C> List<C> debugGetObjectStores(Class<C> clazz)
    • debugGetTypeIds

      public Set<Integer> debugGetTypeIds()
    • getWrittenStringCount

      public int getWrittenStringCount()
    • getWrittenStringBytesCount

      public long getWrittenStringBytesCount()
    • debugEnableWrittenStringPool

      public void debugEnableWrittenStringPool(boolean enable)
    • getWrittenStringPool

      public Set<String> getWrittenStringPool()