org.jboss.marshalling.serialization.java
Class JavaSerializationMarshaller

java.lang.Object
  extended by org.jboss.marshalling.AbstractMarshaller
      extended by org.jboss.marshalling.serialization.java.JavaSerializationMarshaller
All Implemented Interfaces:
java.io.Closeable, java.io.DataOutput, java.io.Flushable, java.io.ObjectOutput, ByteOutput, Marshaller

public class JavaSerializationMarshaller
extends AbstractMarshaller

Version:
$Revision: 1.1 $

Copyright Sep 19, 2008

Author:
Ron Sigal

Field Summary
 
Fields inherited from class org.jboss.marshalling.AbstractMarshaller
bufferSize, byteOutput, classExternalizerFactory, classResolver, classTable, configuredVersion, creator, externalizerFactory, objectResolver, objectTable, streamHeader
 
Constructor Summary
protected JavaSerializationMarshaller(AbstractMarshallerFactory marshallerFactory, MarshallingConfiguration configuration)
           
 
Method Summary
 void clearClassCache()
          Discard the class cache.
 void clearInstanceCache()
          Discard the instance cache.
protected  void doStart()
          Perform any marshaller-specific start activity.
protected  void doWriteObject(java.lang.Object obj, boolean unshared)
          Implementation of the actual object-writing method.
 void finish()
          Finish marshalling to a stream.
 void flush()
          
 ByteOutputStream getOutputStream()
           
 void start(ByteOutput byteOutput)
          Begin marshalling to a stream.
 void write(byte[] b)
          Write all the bytes from the given array to the stream.
 void write(byte[] b, int off, int len)
          Write some of the bytes from the given array to the stream.
 void write(int b)
          Writes to the output stream the eight low-order bits of the argument b.
 void writeBoolean(boolean v)
          
 void writeByte(int v)
          
 void writeBytes(java.lang.String s)
          
 void writeChar(int v)
          
 void writeChars(java.lang.String s)
          
 void writeDouble(double v)
          
 void writeFloat(float v)
          
 void writeInt(int v)
          
 void writeLong(long v)
          
 void writeShort(int v)
          
 void writeUTF(java.lang.String s)
          
 
Methods inherited from class org.jboss.marshalling.AbstractMarshaller
close, writeObject, writeObjectUnshared
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaSerializationMarshaller

protected JavaSerializationMarshaller(AbstractMarshallerFactory marshallerFactory,
                                      MarshallingConfiguration configuration)
                               throws java.io.IOException
Throws:
java.io.IOException
Method Detail

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

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

getOutputStream

public ByteOutputStream getOutputStream()

flush

public void flush()
           throws java.io.IOException

Specified by:
flush in interface java.io.Flushable
Specified by:
flush in interface java.io.ObjectOutput
Overrides:
flush in class AbstractMarshaller
Throws:
java.io.IOException

finish

public void finish()
            throws java.io.IOException
Finish marshalling to a stream. Any transient class or instance cache is discarded. The stream is released. No further marshalling may be done until the Marshaller.start(ByteOutput) method is again invoked.

Specified by:
finish in interface Marshaller
Overrides:
finish in class AbstractMarshaller
Throws:
java.io.IOException - if an error occurs

start

public void start(ByteOutput byteOutput)
           throws java.io.IOException
Description copied from class: AbstractMarshaller
Begin marshalling 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 during setup, such as an error writing the header

doWriteObject

protected void doWriteObject(java.lang.Object obj,
                             boolean unshared)
                      throws java.io.IOException
Description copied from class: AbstractMarshaller
Implementation of the actual object-writing method.

Specified by:
doWriteObject in class AbstractMarshaller
Parameters:
obj - 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

write

public void write(int b)
           throws java.io.IOException
Writes to the output stream the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Specified by:
write in interface java.io.DataOutput
Specified by:
write in interface java.io.ObjectOutput
Specified by:
write in interface ByteOutput
Overrides:
write in class AbstractMarshaller
Parameters:
b - the byte to write
Throws:
java.io.IOException - if an error occurs

write

public void write(byte[] b)
           throws java.io.IOException
Write all the bytes from the given array to the stream.

Specified by:
write in interface java.io.DataOutput
Specified by:
write in interface java.io.ObjectOutput
Specified by:
write in interface ByteOutput
Overrides:
write in class AbstractMarshaller
Parameters:
b - the byte array
Throws:
java.io.IOException - if an error occurs

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Write some of the bytes from the given array to the stream.

Specified by:
write in interface java.io.DataOutput
Specified by:
write in interface java.io.ObjectOutput
Specified by:
write in interface ByteOutput
Overrides:
write in class AbstractMarshaller
Parameters:
b - the byte array
off - the index to start writing from
len - the number of bytes to write
Throws:
java.io.IOException - if an error occurs

writeBoolean

public void writeBoolean(boolean v)
                  throws java.io.IOException

Specified by:
writeBoolean in interface java.io.DataOutput
Overrides:
writeBoolean in class AbstractMarshaller
Throws:
java.io.IOException

writeByte

public void writeByte(int v)
               throws java.io.IOException

Specified by:
writeByte in interface java.io.DataOutput
Overrides:
writeByte in class AbstractMarshaller
Throws:
java.io.IOException

writeShort

public void writeShort(int v)
                throws java.io.IOException

Specified by:
writeShort in interface java.io.DataOutput
Overrides:
writeShort in class AbstractMarshaller
Throws:
java.io.IOException

writeChar

public void writeChar(int v)
               throws java.io.IOException

Specified by:
writeChar in interface java.io.DataOutput
Overrides:
writeChar in class AbstractMarshaller
Throws:
java.io.IOException

writeInt

public void writeInt(int v)
              throws java.io.IOException

Specified by:
writeInt in interface java.io.DataOutput
Overrides:
writeInt in class AbstractMarshaller
Throws:
java.io.IOException

writeLong

public void writeLong(long v)
               throws java.io.IOException

Specified by:
writeLong in interface java.io.DataOutput
Overrides:
writeLong in class AbstractMarshaller
Throws:
java.io.IOException

writeFloat

public void writeFloat(float v)
                throws java.io.IOException

Specified by:
writeFloat in interface java.io.DataOutput
Overrides:
writeFloat in class AbstractMarshaller
Throws:
java.io.IOException

writeDouble

public void writeDouble(double v)
                 throws java.io.IOException

Specified by:
writeDouble in interface java.io.DataOutput
Overrides:
writeDouble in class AbstractMarshaller
Throws:
java.io.IOException

writeBytes

public void writeBytes(java.lang.String s)
                throws java.io.IOException

Specified by:
writeBytes in interface java.io.DataOutput
Overrides:
writeBytes in class AbstractMarshaller
Throws:
java.io.IOException

writeChars

public void writeChars(java.lang.String s)
                throws java.io.IOException

Specified by:
writeChars in interface java.io.DataOutput
Overrides:
writeChars in class AbstractMarshaller
Throws:
java.io.IOException

writeUTF

public void writeUTF(java.lang.String s)
              throws java.io.IOException

Specified by:
writeUTF in interface java.io.DataOutput
Overrides:
writeUTF in class AbstractMarshaller
Throws:
java.io.IOException

doStart

protected void doStart()
                throws java.io.IOException
Description copied from class: AbstractMarshaller
Perform any marshaller-specific start activity. This implementation simply writes the stream header.

Overrides:
doStart in class AbstractMarshaller
Throws:
java.io.IOException - if I/O exception occurs