Package org.jboss.marshalling.river
Class RiverMarshaller
- java.lang.Object
-
- java.io.OutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.DataOutput
,java.io.Flushable
,java.io.ObjectOutput
,java.lang.AutoCloseable
,ByteOutput
,Marshaller
public class RiverMarshaller extends AbstractMarshaller
-
-
Field Summary
Fields Modifier and Type Field Description private static IdentityIntMap<java.lang.Class<?>>
BASIC_CLASSES_V2
private static IdentityIntMap<java.lang.Class<?>>
BASIC_CLASSES_V3
private BlockMarshaller
blockMarshaller
private IdentityIntMap<java.lang.Class<?>>
classCache
private int
classSeq
private java.security.PrivilegedExceptionAction<RiverObjectOutputStream>
createObjectOutputStreamAction
private static java.lang.reflect.Field
ENUM_MAP_KEY_TYPE_FIELD
private static java.lang.reflect.Field
ENUM_SET_ELEMENT_TYPE_FIELD
private static java.lang.reflect.Field
ENUM_SET_VALUES_FIELD
private java.util.IdentityHashMap<java.lang.Class<?>,Externalizer>
externalizers
private IdentityIntMap<java.lang.Object>
instanceCache
private int
instanceSeq
private java.io.ObjectOutput
objectOutput
private RiverObjectOutputStream
objectOutputStream
private SerializableClassRegistry
registry
-
Fields inherited from class org.jboss.marshalling.AbstractMarshaller
classExternalizerFactory, classResolver, classTable, configuredVersion, exceptionListener, objectPreResolver, objectResolver, objectTable, serializabilityChecker, streamHeader
-
Fields inherited from class org.jboss.marshalling.SimpleDataOutput
buffer, bufferSize
-
Fields inherited from class org.jboss.marshalling.ByteOutputStream
byteOutput
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RiverMarshaller(RiverMarshallerFactory marshallerFactory, SerializableClassRegistry registry, MarshallingConfiguration configuration)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearClassCache()
Discard the class cache.void
clearInstanceCache()
Discard the instance cache.private RiverObjectOutputStream
createObjectOutputStream()
protected void
doWriteEmptyFields(SerializableClass info)
protected void
doWriteFields(SerializableClass info, java.lang.Object obj)
protected void
doWriteObject(java.lang.Object original, boolean unshared)
Implementation of the actual object-writing method.protected void
doWriteSerializableObject(SerializableClass info, java.lang.Object obj, java.lang.Class<?> objClass)
private static java.lang.Class<? extends java.lang.Enum>
getAccessibleEnumFieldValue(java.lang.reflect.Field field, java.lang.Object obj)
private static IdentityIntMap<java.lang.Class<?>>
getBasicClasses(int configuredVersion)
protected BlockMarshaller
getBlockMarshaller()
private static java.lang.Class<? extends java.lang.Enum>
getEnumMapKeyType(java.lang.Object obj)
private static java.lang.Enum[]
getEnumSetElements(java.lang.Object obj)
private static java.lang.Class<? extends java.lang.Enum>
getEnumSetElementType(java.lang.Object obj)
protected java.io.ObjectOutput
getObjectOutput()
private RiverObjectOutputStream
getObjectOutputStream()
void
start(ByteOutput byteOutput)
Begin writing to a stream.private void
writeBooleanArray(boolean[] booleans)
protected void
writeClass(java.lang.Class<?> objClass)
protected void
writeClassClass(java.lang.Class<?> classObj)
private void
writeClassTableData(java.lang.Class<?> objClass, ClassTable.Writer classTableWriter)
private void
writeEndBlock()
protected void
writeEnumClass(java.lang.Class<? extends java.lang.Enum> objClass)
protected void
writeExternalizableClass(java.lang.Class<?> objClass)
protected void
writeExternalizerClass(java.lang.Class<?> objClass, Externalizer externalizer)
protected boolean
writeKnownClass(java.lang.Class<?> objClass)
protected void
writeNewClass(java.lang.Class<?> objClass)
protected void
writeNewEnumClass(java.lang.Class<? extends java.lang.Enum> objClass)
protected void
writeNewExternalizableClass(java.lang.Class<?> objClass)
protected void
writeNewExternalizerClass(java.lang.Class<?> objClass, Externalizer externalizer)
protected void
writeNewProxyClass(java.lang.Class<?> objClass)
protected void
writeNewSerializableClass(java.lang.Class<?> objClass)
protected void
writeObjectArrayClass(java.lang.Class<?> objClass)
protected void
writeProxyClass(java.lang.Class<?> objClass)
protected void
writeSerializableClass(java.lang.Class<?> objClass)
private void
writeString(java.lang.String string)
void
writeUTF(java.lang.String string)
-
Methods inherited from class org.jboss.marshalling.AbstractMarshaller
close, finish, writeObject, writeObjectUnshared
-
Methods inherited from class org.jboss.marshalling.SimpleDataOutput
flush, shallowFlush, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.marshalling.ByteOutput
write, write, write
-
-
-
-
Field Detail
-
instanceCache
private final IdentityIntMap<java.lang.Object> instanceCache
-
classCache
private final IdentityIntMap<java.lang.Class<?>> classCache
-
externalizers
private final java.util.IdentityHashMap<java.lang.Class<?>,Externalizer> externalizers
-
instanceSeq
private int instanceSeq
-
classSeq
private int classSeq
-
registry
private final SerializableClassRegistry registry
-
objectOutputStream
private RiverObjectOutputStream objectOutputStream
-
objectOutput
private java.io.ObjectOutput objectOutput
-
blockMarshaller
private BlockMarshaller blockMarshaller
-
createObjectOutputStreamAction
private final java.security.PrivilegedExceptionAction<RiverObjectOutputStream> createObjectOutputStreamAction
-
BASIC_CLASSES_V2
private static final IdentityIntMap<java.lang.Class<?>> BASIC_CLASSES_V2
-
BASIC_CLASSES_V3
private static final IdentityIntMap<java.lang.Class<?>> BASIC_CLASSES_V3
-
ENUM_SET_ELEMENT_TYPE_FIELD
private static final java.lang.reflect.Field ENUM_SET_ELEMENT_TYPE_FIELD
-
ENUM_SET_VALUES_FIELD
private static final java.lang.reflect.Field ENUM_SET_VALUES_FIELD
-
ENUM_MAP_KEY_TYPE_FIELD
private static final java.lang.reflect.Field ENUM_MAP_KEY_TYPE_FIELD
-
-
Constructor Detail
-
RiverMarshaller
protected RiverMarshaller(RiverMarshallerFactory marshallerFactory, SerializableClassRegistry registry, MarshallingConfiguration configuration) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
doWriteObject
protected void doWriteObject(java.lang.Object original, boolean unshared) throws java.io.IOException
Description copied from class:AbstractObjectOutput
Implementation of the actual object-writing method.- Specified by:
doWriteObject
in classAbstractObjectOutput
- Parameters:
original
- the object to writeunshared
-true
if the instance is unshared,false
if it is shared- Throws:
java.io.IOException
- if an I/O error occurs
-
getBasicClasses
private static IdentityIntMap<java.lang.Class<?>> getBasicClasses(int configuredVersion)
-
getEnumMapKeyType
private static java.lang.Class<? extends java.lang.Enum> getEnumMapKeyType(java.lang.Object obj)
-
getEnumSetElementType
private static java.lang.Class<? extends java.lang.Enum> getEnumSetElementType(java.lang.Object obj)
-
getEnumSetElements
private static java.lang.Enum[] getEnumSetElements(java.lang.Object obj)
-
getAccessibleEnumFieldValue
private static java.lang.Class<? extends java.lang.Enum> getAccessibleEnumFieldValue(java.lang.reflect.Field field, java.lang.Object obj)
-
writeBooleanArray
private void writeBooleanArray(boolean[] booleans) throws java.io.IOException
- Throws:
java.io.IOException
-
writeEndBlock
private void writeEndBlock() throws java.io.IOException
- Throws:
java.io.IOException
-
getObjectOutput
protected java.io.ObjectOutput getObjectOutput()
-
getBlockMarshaller
protected BlockMarshaller getBlockMarshaller()
-
getObjectOutputStream
private RiverObjectOutputStream getObjectOutputStream() throws java.io.IOException
- Throws:
java.io.IOException
-
createObjectOutputStream
private RiverObjectOutputStream createObjectOutputStream() throws java.io.IOException
- Throws:
java.io.IOException
-
doWriteSerializableObject
protected void doWriteSerializableObject(SerializableClass info, java.lang.Object obj, java.lang.Class<?> objClass) throws java.io.IOException
- Throws:
java.io.IOException
-
doWriteFields
protected void doWriteFields(SerializableClass info, java.lang.Object obj) throws java.io.IOException
- Throws:
java.io.IOException
-
doWriteEmptyFields
protected void doWriteEmptyFields(SerializableClass info) throws java.io.IOException
- Throws:
java.io.IOException
-
writeProxyClass
protected void writeProxyClass(java.lang.Class<?> objClass) throws java.io.IOException
- Throws:
java.io.IOException
-
writeNewProxyClass
protected void writeNewProxyClass(java.lang.Class<?> objClass) throws java.io.IOException
- Throws:
java.io.IOException
-
writeEnumClass
protected void writeEnumClass(java.lang.Class<? extends java.lang.Enum> objClass) throws java.io.IOException
- Throws:
java.io.IOException
-
writeNewEnumClass
protected void writeNewEnumClass(java.lang.Class<? extends java.lang.Enum> objClass) throws java.io.IOException
- Throws:
java.io.IOException
-
writeClassClass
protected void writeClassClass(java.lang.Class<?> classObj) throws java.io.IOException
- Throws:
java.io.IOException
-
writeObjectArrayClass
protected void writeObjectArrayClass(java.lang.Class<?> objClass) throws java.io.IOException
- Throws:
java.io.IOException
-
writeClass
protected void writeClass(java.lang.Class<?> objClass) throws java.io.IOException
- Throws:
java.io.IOException
-
writeNewClass
protected void writeNewClass(java.lang.Class<?> objClass) throws java.io.IOException
- Throws:
java.io.IOException
-
writeClassTableData
private void writeClassTableData(java.lang.Class<?> objClass, ClassTable.Writer classTableWriter) throws java.io.IOException
- Throws:
java.io.IOException
-
writeKnownClass
protected boolean writeKnownClass(java.lang.Class<?> objClass) throws java.io.IOException
- Throws:
java.io.IOException
-
writeSerializableClass
protected void writeSerializableClass(java.lang.Class<?> objClass) throws java.io.IOException
- Throws:
java.io.IOException
-
writeNewSerializableClass
protected void writeNewSerializableClass(java.lang.Class<?> objClass) throws java.io.IOException
- Throws:
java.io.IOException
-
writeExternalizableClass
protected void writeExternalizableClass(java.lang.Class<?> objClass) throws java.io.IOException
- Throws:
java.io.IOException
-
writeNewExternalizableClass
protected void writeNewExternalizableClass(java.lang.Class<?> objClass) throws java.io.IOException
- Throws:
java.io.IOException
-
writeExternalizerClass
protected void writeExternalizerClass(java.lang.Class<?> objClass, Externalizer externalizer) throws java.io.IOException
- Throws:
java.io.IOException
-
writeNewExternalizerClass
protected void writeNewExternalizerClass(java.lang.Class<?> objClass, Externalizer externalizer) throws java.io.IOException
- Throws:
java.io.IOException
-
clearInstanceCache
public void clearInstanceCache() throws java.io.IOException
Description copied from interface:Marshaller
Discard the instance cache. May also discard the class cache in implementations that do not support separated class and instance caches.- Throws:
java.io.IOException
- if an error occurs
-
clearClassCache
public void clearClassCache() throws java.io.IOException
Description copied from interface:Marshaller
Discard the class cache. Implicitly also discards the instance cache.- Throws:
java.io.IOException
- if an error occurs
-
start
public void start(ByteOutput byteOutput) throws java.io.IOException
Description copied from class:AbstractMarshaller
Begin writing to a stream.- Specified by:
start
in interfaceMarshaller
- Overrides:
start
in classAbstractMarshaller
- Parameters:
byteOutput
- the new stream- Throws:
java.io.IOException
- if an error occurs
-
writeString
private void writeString(java.lang.String string) throws java.io.IOException
- Throws:
java.io.IOException
-
writeUTF
public void writeUTF(java.lang.String string) throws java.io.IOException
Description copied from class:SimpleDataOutput
- Specified by:
writeUTF
in interfacejava.io.DataOutput
- Overrides:
writeUTF
in classSimpleDataOutput
- Throws:
java.io.IOException
-
-