Class BinaryObjectEncoder
java.lang.Object
org.identityconnectors.framework.impl.serializer.binary.BinaryObjectEncoder
- All Implemented Interfaces:
BinaryObjectSerializer
,ObjectEncoder
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Version for the overall encoding - if we need to change anything in the encoder, we will need to bump this and handle appropriatelystatic final byte
static final byte
static final byte
static final int
static final byte
static final byte
static final byte
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the underylying stream after first flushing it.void
flush()
Flushes the underlying stream.void
writeBooleanContents
(boolean v) Writes the value in-line.void
writeBooleanField
(String fieldName, boolean v) Writes a boolean.void
writeByteArrayContents
(byte[] v) Special case for byte [] that uses base64 encoding for XMLvoid
writeByteContents
(byte v) Writes the value in-line.void
writeClassContents
(Class<?> v) Writes the value in-line.void
writeClassField
(String fieldName, Class<?> v) Writes a Class.void
writeDoubleContents
(double v) Writes the value in-line.void
writeDoubleField
(String fieldName, double v) Writes a double.void
writeFloatContents
(float v) Writes the value in-line.void
writeFloatField
(String fieldName, float v) Writes a float.void
writeIntContents
(int v) Writes the value in-line.void
writeIntField
(String fieldName, int v) Writes an int.void
writeLongContents
(long v) Writes the value in-line.void
writeLongField
(String fieldName, long v) Writes a long.void
Writes the next object to the stream.void
writeObjectContents
(Object object) Writes a sub-objectvoid
writeObjectField
(String fieldName, Object object, boolean inline) Writes an object using the appropriate serializer for that objectvoid
Writes the value in-line.void
writeStringField
(String fieldName, String v) Writes a String.
-
Field Details
-
ENCODING_VERSION
public static final int ENCODING_VERSIONVersion for the overall encoding - if we need to change anything in the encoder, we will need to bump this and handle appropriately- See Also:
-
OBJECT_MAGIC
public static final int OBJECT_MAGIC- See Also:
-
OBJECT_TYPE_NULL
public static final byte OBJECT_TYPE_NULL- See Also:
-
OBJECT_TYPE_CLASS
public static final byte OBJECT_TYPE_CLASS- See Also:
-
OBJECT_TYPE_ARRAY
public static final byte OBJECT_TYPE_ARRAY- See Also:
-
FIELD_TYPE_ANONYMOUS_FIELD
public static final byte FIELD_TYPE_ANONYMOUS_FIELD- See Also:
-
FIELD_TYPE_NAMED_FIELD
public static final byte FIELD_TYPE_NAMED_FIELD- See Also:
-
FIELD_TYPE_END_OBJECT
public static final byte FIELD_TYPE_END_OBJECT- See Also:
-
-
Constructor Details
-
BinaryObjectEncoder
-
-
Method Details
-
flush
public void flush()Description copied from interface:BinaryObjectSerializer
Flushes the underlying stream.- Specified by:
flush
in interfaceBinaryObjectSerializer
-
close
public void close()Description copied from interface:BinaryObjectSerializer
Closes the underylying stream after first flushing it.- Specified by:
close
in interfaceBinaryObjectSerializer
-
writeObject
Description copied from interface:BinaryObjectSerializer
Writes the next object to the stream.- Specified by:
writeObject
in interfaceBinaryObjectSerializer
- Parameters:
o
- The object to write.- See Also:
-
writeBooleanContents
public void writeBooleanContents(boolean v) Description copied from interface:ObjectEncoder
Writes the value in-line.- Specified by:
writeBooleanContents
in interfaceObjectEncoder
-
writeBooleanField
Description copied from interface:ObjectEncoder
Writes a boolean.- Specified by:
writeBooleanField
in interfaceObjectEncoder
- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serializationv
- The value to serialize
-
writeByteContents
public void writeByteContents(byte v) Description copied from interface:ObjectEncoder
Writes the value in-line.- Specified by:
writeByteContents
in interfaceObjectEncoder
-
writeByteArrayContents
public void writeByteArrayContents(byte[] v) Description copied from interface:ObjectEncoder
Special case for byte [] that uses base64 encoding for XML- Specified by:
writeByteArrayContents
in interfaceObjectEncoder
-
writeClassContents
Description copied from interface:ObjectEncoder
Writes the value in-line.- Specified by:
writeClassContents
in interfaceObjectEncoder
-
writeClassField
Description copied from interface:ObjectEncoder
Writes a Class.- Specified by:
writeClassField
in interfaceObjectEncoder
- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serializationv
- The value to serialize
-
writeDoubleContents
public void writeDoubleContents(double v) Description copied from interface:ObjectEncoder
Writes the value in-line.- Specified by:
writeDoubleContents
in interfaceObjectEncoder
-
writeDoubleField
Description copied from interface:ObjectEncoder
Writes a double.- Specified by:
writeDoubleField
in interfaceObjectEncoder
- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serializationv
- The value to serialize
-
writeFloatContents
public void writeFloatContents(float v) Description copied from interface:ObjectEncoder
Writes the value in-line.- Specified by:
writeFloatContents
in interfaceObjectEncoder
-
writeFloatField
Description copied from interface:ObjectEncoder
Writes a float.- Specified by:
writeFloatField
in interfaceObjectEncoder
- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serializationv
- The value to serialize
-
writeIntContents
public void writeIntContents(int v) Description copied from interface:ObjectEncoder
Writes the value in-line.- Specified by:
writeIntContents
in interfaceObjectEncoder
-
writeIntField
Description copied from interface:ObjectEncoder
Writes an int.- Specified by:
writeIntField
in interfaceObjectEncoder
- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serializationv
- The value to serialize
-
writeLongContents
public void writeLongContents(long v) Description copied from interface:ObjectEncoder
Writes the value in-line.- Specified by:
writeLongContents
in interfaceObjectEncoder
-
writeLongField
Description copied from interface:ObjectEncoder
Writes a long.- Specified by:
writeLongField
in interfaceObjectEncoder
- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serializationv
- The value to serialize
-
writeObjectContents
Description copied from interface:ObjectEncoder
Writes a sub-object- Specified by:
writeObjectContents
in interfaceObjectEncoder
- Parameters:
object
- The object to write
-
writeObjectField
Description copied from interface:ObjectEncoder
Writes an object using the appropriate serializer for that object- Specified by:
writeObjectField
in interfaceObjectEncoder
- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the subelement name for xml serializationobject
- The object to serializeinline
- Ignore for binary serialization. For xml serialization, this causes us not to have a sub-element. When inlining, polymorphic typing is not supported.
-
writeStringContents
Description copied from interface:ObjectEncoder
Writes the value in-line.- Specified by:
writeStringContents
in interfaceObjectEncoder
-
writeStringField
Description copied from interface:ObjectEncoder
Writes a String.- Specified by:
writeStringField
in interfaceObjectEncoder
- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serializationv
- The value to serialize
-