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_V2private static IdentityIntMap<java.lang.Class<?>>BASIC_CLASSES_V3private BlockMarshallerblockMarshallerprivate IdentityIntMap<java.lang.Class<?>>classCacheprivate intclassSeqprivate java.security.PrivilegedExceptionAction<RiverObjectOutputStream>createObjectOutputStreamActionprivate static java.lang.reflect.FieldENUM_MAP_KEY_TYPE_FIELDprivate static java.lang.reflect.FieldENUM_SET_ELEMENT_TYPE_FIELDprivate static java.lang.reflect.FieldENUM_SET_VALUES_FIELDprivate java.util.IdentityHashMap<java.lang.Class<?>,Externalizer>externalizersprivate IdentityIntMap<java.lang.Object>instanceCacheprivate intinstanceSeqprivate java.io.ObjectOutputobjectOutputprivate RiverObjectOutputStreamobjectOutputStreamprivate SerializableClassRegistryregistry-
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 protectedRiverMarshaller(RiverMarshallerFactory marshallerFactory, SerializableClassRegistry registry, MarshallingConfiguration configuration)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearClassCache()Discard the class cache.voidclearInstanceCache()Discard the instance cache.private RiverObjectOutputStreamcreateObjectOutputStream()protected voiddoWriteEmptyFields(SerializableClass info)protected voiddoWriteFields(SerializableClass info, java.lang.Object obj)protected voiddoWriteObject(java.lang.Object original, boolean unshared)Implementation of the actual object-writing method.protected voiddoWriteSerializableObject(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 BlockMarshallergetBlockMarshaller()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.ObjectOutputgetObjectOutput()private RiverObjectOutputStreamgetObjectOutputStream()voidstart(ByteOutput byteOutput)Begin writing to a stream.private voidwriteBooleanArray(boolean[] booleans)protected voidwriteClass(java.lang.Class<?> objClass)protected voidwriteClassClass(java.lang.Class<?> classObj)private voidwriteClassTableData(java.lang.Class<?> objClass, ClassTable.Writer classTableWriter)private voidwriteEndBlock()protected voidwriteEnumClass(java.lang.Class<? extends java.lang.Enum> objClass)protected voidwriteExternalizableClass(java.lang.Class<?> objClass)protected voidwriteExternalizerClass(java.lang.Class<?> objClass, Externalizer externalizer)protected booleanwriteKnownClass(java.lang.Class<?> objClass)protected voidwriteNewClass(java.lang.Class<?> objClass)protected voidwriteNewEnumClass(java.lang.Class<? extends java.lang.Enum> objClass)protected voidwriteNewExternalizableClass(java.lang.Class<?> objClass)protected voidwriteNewExternalizerClass(java.lang.Class<?> objClass, Externalizer externalizer)protected voidwriteNewProxyClass(java.lang.Class<?> objClass)protected voidwriteNewSerializableClass(java.lang.Class<?> objClass)protected voidwriteObjectArrayClass(java.lang.Class<?> objClass)protected voidwriteProxyClass(java.lang.Class<?> objClass)protected voidwriteSerializableClass(java.lang.Class<?> objClass)private voidwriteString(java.lang.String string)voidwriteUTF(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.IOExceptionDescription copied from class:AbstractObjectOutputImplementation of the actual object-writing method.- Specified by:
doWriteObjectin classAbstractObjectOutput- Parameters:
original- the object to writeunshared-trueif the instance is unshared,falseif 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.IOExceptionDescription copied from interface:MarshallerDiscard 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.IOExceptionDescription copied from interface:MarshallerDiscard 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:AbstractMarshallerBegin writing to a stream.- Specified by:
startin interfaceMarshaller- Overrides:
startin 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.IOExceptionDescription copied from class:SimpleDataOutput- Specified by:
writeUTFin interfacejava.io.DataOutput- Overrides:
writeUTFin classSimpleDataOutput- Throws:
java.io.IOException
-
-