Class RiverMarshaller

  • 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 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
      • objectOutput

        private java.io.ObjectOutput objectOutput
      • 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
    • 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 class AbstractObjectOutput
        Parameters:
        original - the object to write
        unshared - 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()
      • 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 interface Marshaller
        Overrides:
        start in class AbstractMarshaller
        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 interface java.io.DataOutput
        Overrides:
        writeUTF in class SimpleDataOutput
        Throws:
        java.io.IOException