public class

Serializer

extends Object
implements IInternalSerializer
java.lang.Object
   ↳ com.pnfsoftware.jeb.util.serialization.Serializer

Class Overview

This class allows the serialization of object(s) to a stream of bytes.

The serialize(Object) method is interruptible.

Summary

Fields
public ReferenceCounter<Integer> collectionSizes
public ReferenceCounter<String> dbgObjectCounts
public Map<String, List<Object>> dbgObjectStores
public Set<Integer> dbgTypeIds
public int deferredCount
public long writtenStringBytesCount
public int writtenStringCount
public Set<String> writtenStringPool
Public Constructors
Serializer(ITypeIdProvider customTypeIdProvider, OutputStream stream, boolean generateStringPool)
Public Methods
void addProgressCallback(IProgressCallback callback)
void close()
void debugEnable(boolean enableObjectCounting, boolean enableObjectStoring, boolean enableTypeIdStoring)
void debugEnableWrittenStringPool(boolean enable)
ReferenceCounter<String> debugGetObjectCounts()
Map<String, List<Object>> debugGetObjectStores()
<C> List<C> debugGetObjectStores(Class<C> clazz)
Set<Integer> debugGetTypeIds()
long getLastWrittenSize()
Retrieve the number of bytes (may be approximate) generated by the last call made to serialize(Object).
int getObjectCount()
Retrieve the number of serialized or partially serialized objects.
int getRootCount()
OutputStream getStream()
List<String> getStringPool()
int getWrittenObjectCount()
long getWrittenStringBytesCount()
int getWrittenStringCount()
Set<String> getWrittenStringPool()
void removeProgressCallback(IProgressCallback callback)
void serialize(Object root)
void setCustomSerializationClassFlags(Class<?> c, int flags)
void setExpectedObjectCount(int count)
void setup(boolean simulation)
void write(Object o)
void writeFields(Object o, Class<?> targetClass)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pnfsoftware.jeb.util.serialization.IInternalSerializer

Fields

public ReferenceCounter<Integer> collectionSizes

public ReferenceCounter<String> dbgObjectCounts

public Map<String, List<Object>> dbgObjectStores

public Set<Integer> dbgTypeIds

public int deferredCount

public long writtenStringBytesCount

public int writtenStringCount

public Set<String> writtenStringPool

Public Constructors

public Serializer (ITypeIdProvider customTypeIdProvider, OutputStream stream, boolean generateStringPool)

Public Methods

public void addProgressCallback (IProgressCallback callback)

public void close ()

Throws
IOException

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

public void debugEnableWrittenStringPool (boolean enable)

public ReferenceCounter<String> debugGetObjectCounts ()

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

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

public Set<Integer> debugGetTypeIds ()

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

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.

public int getRootCount ()

public OutputStream getStream ()

public List<String> getStringPool ()

public int getWrittenObjectCount ()

public long getWrittenStringBytesCount ()

public int getWrittenStringCount ()

public Set<String> getWrittenStringPool ()

public void removeProgressCallback (IProgressCallback callback)

public void serialize (Object root)

Throws
IOException

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

public void setExpectedObjectCount (int count)

public void setup (boolean simulation)

public void write (Object o)

Throws
IOException

public void writeFields (Object o, Class<?> targetClass)

Throws
IOException