org.jboss.serial.io
Class JBossObjectOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.ObjectOutputStream
          extended by org.jboss.serial.io.JBossObjectOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.DataOutput, java.io.Flushable, java.io.ObjectOutput, java.io.ObjectStreamConstants, DataContainerConstants
Direct Known Subclasses:
JBossObjectOutputStreamSharedTree

public class JBossObjectOutputStream
extends java.io.ObjectOutputStream
implements DataContainerConstants

Author:
Clebert Suconic

Nested Class Summary
 
Nested classes/interfaces inherited from class java.io.ObjectOutputStream
java.io.ObjectOutputStream.PutField
 
Field Summary
 
Fields inherited from interface org.jboss.serial.objectmetamodel.DataContainerConstants
BOOLEAN, BOOLEANOBJ, BYTE, BYTEARRAY, BYTEOBJ, CHARACTER, CHARACTEROBJ, CLASSDEF, closeSign, DOUBLE, DOUBLEOBJ, FLOAT, FLOATOBJ, IMMUTABLE_OBJREF, INTEGER, INTEGEROBJ, LONG, LONGOBJ, NEWDEF, NULLREF, OBJECTDEF, OBJECTREF, openSign, RESET, SHORT, SHORTOBJ, SMARTCLONE_DEF, STRING
 
Fields inherited from interface java.io.ObjectStreamConstants
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_ENUM, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, STREAM_MAGIC, STREAM_VERSION, SUBCLASS_IMPLEMENTATION_PERMISSION, SUBSTITUTION_PERMISSION, TC_ARRAY, TC_BASE, TC_BLOCKDATA, TC_BLOCKDATALONG, TC_CLASS, TC_CLASSDESC, TC_ENDBLOCKDATA, TC_ENUM, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING
 
Constructor Summary
JBossObjectOutputStream(java.io.OutputStream output)
          Creates an OutputStream, that by default doesn't require
JBossObjectOutputStream(java.io.OutputStream output, boolean checkSerializableClass)
           
JBossObjectOutputStream(java.io.OutputStream output, boolean checkSerializableClass, StringUtilBuffer buffer)
           
JBossObjectOutputStream(java.io.OutputStream output, StringUtilBuffer buffer)
          Creates an OutputStream, that by default doesn't require
 
Method Summary
 void close()
           
 void defaultWriteObject()
           
 void flush()
          Flushes the stream.
 void reset()
           
 java.lang.Object smartClone(java.lang.Object obj)
          Reuses every primitive value to recreate another object.
 java.lang.Object smartClone(java.lang.Object obj, SafeCloningRepository safeToReuse)
          Reuses every primitive value to recreate another object.
 java.lang.Object smartClone(java.lang.Object obj, SafeCloningRepository safeToReuse, java.lang.ClassLoader loader)
          Reuses every primitive value to recreate another object.
 void write(byte[] buf)
          Writes an array of bytes.
 void write(byte[] buf, int off, int len)
           
 void write(int val)
          Writes a byte.
 void writeBoolean(boolean val)
           
 void writeByte(int val)
           
 void writeBytes(java.lang.String str)
           
 void writeChar(int val)
           
 void writeChars(java.lang.String str)
           
 void writeDouble(double val)
           
 void writeFields()
           
 void writeFloat(float val)
           
 void writeInt(int val)
           
 void writeLong(long val)
           
 void writeObjectUsingDataContainer(java.lang.Object obj)
           
 void writeShort(int val)
           
 void writeUnshared(java.lang.Object obj)
           
 void writeUTF(java.lang.String str)
           
 
Methods inherited from class java.io.ObjectOutputStream
putFields, useProtocolVersion, writeObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JBossObjectOutputStream

public JBossObjectOutputStream(java.io.OutputStream output)
                        throws java.io.IOException
Creates an OutputStream, that by default doesn't require

Throws:
java.io.IOException

JBossObjectOutputStream

public JBossObjectOutputStream(java.io.OutputStream output,
                               StringUtilBuffer buffer)
                        throws java.io.IOException
Creates an OutputStream, that by default doesn't require

Throws:
java.io.IOException

JBossObjectOutputStream

public JBossObjectOutputStream(java.io.OutputStream output,
                               boolean checkSerializableClass)
                        throws java.io.IOException
Throws:
java.io.IOException

JBossObjectOutputStream

public JBossObjectOutputStream(java.io.OutputStream output,
                               boolean checkSerializableClass,
                               StringUtilBuffer buffer)
                        throws java.io.IOException
Throws:
java.io.IOException
Method Detail

writeObjectUsingDataContainer

public void writeObjectUsingDataContainer(java.lang.Object obj)
                                   throws java.io.IOException
Throws:
java.io.IOException

writeUnshared

public void writeUnshared(java.lang.Object obj)
                   throws java.io.IOException
Overrides:
writeUnshared in class java.io.ObjectOutputStream
Throws:
java.io.IOException

defaultWriteObject

public void defaultWriteObject()
                        throws java.io.IOException
Overrides:
defaultWriteObject in class java.io.ObjectOutputStream
Throws:
java.io.IOException

writeFields

public void writeFields()
                 throws java.io.IOException
Overrides:
writeFields in class java.io.ObjectOutputStream
Throws:
java.io.IOException

reset

public void reset()
           throws java.io.IOException
Overrides:
reset in class java.io.ObjectOutputStream
Throws:
java.io.IOException

write

public void write(int val)
           throws java.io.IOException
Writes a byte. This method will block until the byte is actually written.

Specified by:
write in interface java.io.DataOutput
Specified by:
write in interface java.io.ObjectOutput
Overrides:
write in class java.io.ObjectOutputStream
Parameters:
val - the byte to be written to the stream
Throws:
java.io.IOException - If an I/O error has occurred.

write

public void write(byte[] buf)
           throws java.io.IOException
Writes an array of bytes. This method will block until the bytes are actually written.

Specified by:
write in interface java.io.DataOutput
Specified by:
write in interface java.io.ObjectOutput
Overrides:
write in class java.io.ObjectOutputStream
Parameters:
buf - the data to be written
Throws:
java.io.IOException - If an I/O error has occurred.

write

public void write(byte[] buf,
                  int off,
                  int len)
           throws java.io.IOException
Specified by:
write in interface java.io.DataOutput
Specified by:
write in interface java.io.ObjectOutput
Overrides:
write in class java.io.ObjectOutputStream
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Flushes the stream. This will write any buffered output bytes and flush through to the underlying stream.

Specified by:
flush in interface java.io.Flushable
Specified by:
flush in interface java.io.ObjectOutput
Overrides:
flush in class java.io.ObjectOutputStream
Throws:
java.io.IOException - If an I/O error has occurred.

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in interface java.io.ObjectOutput
Overrides:
close in class java.io.ObjectOutputStream
Throws:
java.io.IOException

writeBoolean

public void writeBoolean(boolean val)
                  throws java.io.IOException
Specified by:
writeBoolean in interface java.io.DataOutput
Overrides:
writeBoolean in class java.io.ObjectOutputStream
Throws:
java.io.IOException

writeByte

public void writeByte(int val)
               throws java.io.IOException
Specified by:
writeByte in interface java.io.DataOutput
Overrides:
writeByte in class java.io.ObjectOutputStream
Throws:
java.io.IOException

writeShort

public void writeShort(int val)
                throws java.io.IOException
Specified by:
writeShort in interface java.io.DataOutput
Overrides:
writeShort in class java.io.ObjectOutputStream
Throws:
java.io.IOException

writeChar

public void writeChar(int val)
               throws java.io.IOException
Specified by:
writeChar in interface java.io.DataOutput
Overrides:
writeChar in class java.io.ObjectOutputStream
Throws:
java.io.IOException

writeInt

public void writeInt(int val)
              throws java.io.IOException
Specified by:
writeInt in interface java.io.DataOutput
Overrides:
writeInt in class java.io.ObjectOutputStream
Throws:
java.io.IOException

writeLong

public void writeLong(long val)
               throws java.io.IOException
Specified by:
writeLong in interface java.io.DataOutput
Overrides:
writeLong in class java.io.ObjectOutputStream
Throws:
java.io.IOException

writeFloat

public void writeFloat(float val)
                throws java.io.IOException
Specified by:
writeFloat in interface java.io.DataOutput
Overrides:
writeFloat in class java.io.ObjectOutputStream
Throws:
java.io.IOException

writeDouble

public void writeDouble(double val)
                 throws java.io.IOException
Specified by:
writeDouble in interface java.io.DataOutput
Overrides:
writeDouble in class java.io.ObjectOutputStream
Throws:
java.io.IOException

writeBytes

public void writeBytes(java.lang.String str)
                throws java.io.IOException
Specified by:
writeBytes in interface java.io.DataOutput
Overrides:
writeBytes in class java.io.ObjectOutputStream
Throws:
java.io.IOException

writeChars

public void writeChars(java.lang.String str)
                throws java.io.IOException
Specified by:
writeChars in interface java.io.DataOutput
Overrides:
writeChars in class java.io.ObjectOutputStream
Throws:
java.io.IOException

writeUTF

public void writeUTF(java.lang.String str)
              throws java.io.IOException
Specified by:
writeUTF in interface java.io.DataOutput
Overrides:
writeUTF in class java.io.ObjectOutputStream
Throws:
java.io.IOException

smartClone

public java.lang.Object smartClone(java.lang.Object obj)
                            throws java.io.IOException
Reuses every primitive value to recreate another object.

Throws:
java.io.IOException

smartClone

public java.lang.Object smartClone(java.lang.Object obj,
                                   SafeCloningRepository safeToReuse)
                            throws java.io.IOException
Reuses every primitive value to recreate another object.

Throws:
java.io.IOException

smartClone

public java.lang.Object smartClone(java.lang.Object obj,
                                   SafeCloningRepository safeToReuse,
                                   java.lang.ClassLoader loader)
                            throws java.io.IOException
Reuses every primitive value to recreate another object. and if safeToReuse!=null, it can reuse the entire object

Throws:
java.io.IOException


JBoss Serialization, a new approach to java-serialization.