Class BinaryObjectEncoder
- java.lang.Object
-
- org.identityconnectors.framework.impl.serializer.binary.BinaryObjectEncoder
-
- All Implemented Interfaces:
org.identityconnectors.framework.common.serializer.BinaryObjectSerializer,ObjectEncoder
public class BinaryObjectEncoder extends Object implements ObjectEncoder, org.identityconnectors.framework.common.serializer.BinaryObjectSerializer
-
-
Field Summary
Fields Modifier and Type Field Description static intENCODING_VERSIONVersion for the overall encoding - if we need to change anything in the encoder, we will need to bump this and handle appropriatelystatic byteFIELD_TYPE_ANONYMOUS_FIELDstatic byteFIELD_TYPE_END_OBJECTstatic byteFIELD_TYPE_NAMED_FIELDstatic intOBJECT_MAGICstatic byteOBJECT_TYPE_ARRAYstatic byteOBJECT_TYPE_CLASSstatic byteOBJECT_TYPE_NULL
-
Constructor Summary
Constructors Constructor Description BinaryObjectEncoder(OutputStream output)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()voidwriteBooleanContents(boolean v)Writes the value in-line.voidwriteBooleanField(String fieldName, boolean v)Writes a boolean.voidwriteByteArrayContents(byte[] v)Special case for byte [] that uses base64 encoding for XMLvoidwriteByteContents(byte v)Writes the value in-line.voidwriteClassContents(Class<?> v)Writes the value in-line.voidwriteClassField(String fieldName, Class<?> v)Writes a Class.voidwriteDoubleContents(double v)Writes the value in-line.voidwriteDoubleField(String fieldName, double v)Writes a double.voidwriteFloatContents(float v)Writes the value in-line.voidwriteFloatField(String fieldName, float v)Writes a float.voidwriteIntContents(int v)Writes the value in-line.voidwriteIntField(String fieldName, int v)Writes an int.voidwriteLongContents(long v)Writes the value in-line.voidwriteLongField(String fieldName, long v)Writes a long.voidwriteObject(Object o)voidwriteObjectContents(Object object)Writes a sub-objectvoidwriteObjectField(String fieldName, Object object, boolean inline)Writes an object using the appropriate serializer for that objectvoidwriteStringContents(String str)Writes the value in-line.voidwriteStringField(String fieldName, String v)Writes a String.
-
-
-
Field Detail
-
ENCODING_VERSION
public static final int ENCODING_VERSION
Version for the overall encoding - if we need to change anything in the encoder, we will need to bump this and handle appropriately- See Also:
- Constant Field Values
-
OBJECT_MAGIC
public static final int OBJECT_MAGIC
- See Also:
- Constant Field Values
-
OBJECT_TYPE_NULL
public static final byte OBJECT_TYPE_NULL
- See Also:
- Constant Field Values
-
OBJECT_TYPE_CLASS
public static final byte OBJECT_TYPE_CLASS
- See Also:
- Constant Field Values
-
OBJECT_TYPE_ARRAY
public static final byte OBJECT_TYPE_ARRAY
- See Also:
- Constant Field Values
-
FIELD_TYPE_ANONYMOUS_FIELD
public static final byte FIELD_TYPE_ANONYMOUS_FIELD
- See Also:
- Constant Field Values
-
FIELD_TYPE_NAMED_FIELD
public static final byte FIELD_TYPE_NAMED_FIELD
- See Also:
- Constant Field Values
-
FIELD_TYPE_END_OBJECT
public static final byte FIELD_TYPE_END_OBJECT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BinaryObjectEncoder
public BinaryObjectEncoder(OutputStream output)
-
-
Method Detail
-
flush
public void flush()
- Specified by:
flushin interfaceorg.identityconnectors.framework.common.serializer.BinaryObjectSerializer
-
close
public void close()
- Specified by:
closein interfaceorg.identityconnectors.framework.common.serializer.BinaryObjectSerializer
-
writeObject
public void writeObject(Object o)
- Specified by:
writeObjectin interfaceorg.identityconnectors.framework.common.serializer.BinaryObjectSerializer
-
writeBooleanContents
public void writeBooleanContents(boolean v)
Description copied from interface:ObjectEncoderWrites the value in-line.- Specified by:
writeBooleanContentsin interfaceObjectEncoder
-
writeBooleanField
public void writeBooleanField(String fieldName, boolean v)
Description copied from interface:ObjectEncoderWrites a boolean.- Specified by:
writeBooleanFieldin 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:ObjectEncoderWrites the value in-line.- Specified by:
writeByteContentsin interfaceObjectEncoder
-
writeByteArrayContents
public void writeByteArrayContents(byte[] v)
Description copied from interface:ObjectEncoderSpecial case for byte [] that uses base64 encoding for XML- Specified by:
writeByteArrayContentsin interfaceObjectEncoder
-
writeClassContents
public void writeClassContents(Class<?> v)
Description copied from interface:ObjectEncoderWrites the value in-line.- Specified by:
writeClassContentsin interfaceObjectEncoder
-
writeClassField
public void writeClassField(String fieldName, Class<?> v)
Description copied from interface:ObjectEncoderWrites a Class.- Specified by:
writeClassFieldin 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:ObjectEncoderWrites the value in-line.- Specified by:
writeDoubleContentsin interfaceObjectEncoder
-
writeDoubleField
public void writeDoubleField(String fieldName, double v)
Description copied from interface:ObjectEncoderWrites a double.- Specified by:
writeDoubleFieldin 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:ObjectEncoderWrites the value in-line.- Specified by:
writeFloatContentsin interfaceObjectEncoder
-
writeFloatField
public void writeFloatField(String fieldName, float v)
Description copied from interface:ObjectEncoderWrites a float.- Specified by:
writeFloatFieldin 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:ObjectEncoderWrites the value in-line.- Specified by:
writeIntContentsin interfaceObjectEncoder
-
writeIntField
public void writeIntField(String fieldName, int v)
Description copied from interface:ObjectEncoderWrites an int.- Specified by:
writeIntFieldin 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:ObjectEncoderWrites the value in-line.- Specified by:
writeLongContentsin interfaceObjectEncoder
-
writeLongField
public void writeLongField(String fieldName, long v)
Description copied from interface:ObjectEncoderWrites a long.- Specified by:
writeLongFieldin 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
public void writeObjectContents(Object object)
Description copied from interface:ObjectEncoderWrites a sub-object- Specified by:
writeObjectContentsin interfaceObjectEncoder- Parameters:
object- The object to write
-
writeObjectField
public void writeObjectField(String fieldName, Object object, boolean inline)
Description copied from interface:ObjectEncoderWrites an object using the appropriate serializer for that object- Specified by:
writeObjectFieldin 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
public void writeStringContents(String str)
Description copied from interface:ObjectEncoderWrites the value in-line.- Specified by:
writeStringContentsin interfaceObjectEncoder
-
writeStringField
public void writeStringField(String fieldName, String v)
Description copied from interface:ObjectEncoderWrites a String.- Specified by:
writeStringFieldin interfaceObjectEncoder- Parameters:
fieldName- A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serializationv- The value to serialize
-
-