# Class: com.pnfsoftware.jeb.util.serialization.Serializer

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

 The [#serialize(Object)](#serialize(Object)) method is interruptible.

## Constructor: Serializer
- parameter: `customTypeIdProvider`, type: `com.pnfsoftware.jeb.util.serialization.ITypeIdProvider`
- parameter: `stream`, type: `java.io.OutputStream`
- parameter: `generateStringPool`, type: `boolean`


## Field: collectionSizes
Type: `com.pnfsoftware.jeb.util.collect.ReferenceCounter<java.lang.Integer>`

## Field: dbgObjectCounts
Type: `com.pnfsoftware.jeb.util.collect.ReferenceCounter<java.lang.String>`

## Field: dbgObjectStores
Type: `java.util.Map<java.lang.String,java.util.List<java.lang.Object>>`

## Field: dbgTypeIds
Type: `java.util.Set<java.lang.Integer>`

## Field: deferredCount
Type: `int`

## Field: writtenStringBytesCount
Type: `long`

## Field: writtenStringCount
Type: `int`

## Field: writtenStringPool
Type: `java.util.Set<java.lang.String>`

## Method: addProgressCallback
- parameter: `callback`, type: `com.pnfsoftware.jeb.util.base.IProgressCallback`


## Method: close


## Method: debugEnable
- parameter: `enableObjectCounting`, type: `boolean`
- parameter: `enableObjectStoring`, type: `boolean`
- parameter: `enableTypeIdStoring`, type: `boolean`


## Method: debugEnableWrittenStringPool
- parameter: `enable`, type: `boolean`


## Method: debugGetObjectCounts
- return type: `com.pnfsoftware.jeb.util.collect.ReferenceCounter<java.lang.String>`


## Method: debugGetObjectStores
- return type: `java.util.Map<java.lang.String,java.util.List<java.lang.Object>>`


## Method: debugGetObjectStores
- parameter: `clazz`, type: `java.lang.Class<C>`
- return type: `java.util.List<C>`


## Method: debugGetTypeIds
- return type: `java.util.Set<java.lang.Integer>`


## Method: getLastWrittenSize
- return type: `long`

Description: Retrieve the number of bytes \(may be approximate\) generated by the last call made to [#serialize(Object)](#serialize(Object)).
return: a number of bytes, possibly an approximation if the last call to         [#serialize(Object)](#serialize(Object)) was made in `simulation` mode

## Method: getObjectCount
- return type: `int`

Description: 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()](#getWrittenObjectCount()) to get it.
return: 

## Method: getRootCount
- return type: `int`


## Method: getStream
- return type: `java.io.OutputStream`


## Method: getStringPool
- return type: `java.util.List<java.lang.String>`


## Method: getWrittenObjectCount
- return type: `int`


## Method: getWrittenStringBytesCount
- return type: `long`


## Method: getWrittenStringCount
- return type: `int`


## Method: getWrittenStringPool
- return type: `java.util.Set<java.lang.String>`


## Method: removeProgressCallback
- parameter: `callback`, type: `com.pnfsoftware.jeb.util.base.IProgressCallback`


## Method: serialize
- parameter: `root`, type: `java.lang.Object`


## Method: setCustomSerializationClassFlags
- parameter: `c`, type: `java.lang.Class<?>`
- parameter: `flags`, type: `int`


## Method: setExpectedObjectCount
- parameter: `count`, type: `int`


## Method: setup
- parameter: `simulation`, type: `boolean`


## Method: write
- parameter: `o`, type: `java.lang.Object`


## Method: writeFields
- parameter: `o`, type: `java.lang.Object`
- parameter: `targetClass`, type: `java.lang.Class<?>`


## Method: writeFields
- parameter: `o`, type: `java.lang.Object`
- parameter: `targetClass`, type: `java.lang.Class<?>`
- parameter: `containerSerTypeId`, type: `java.lang.Integer`


