Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.axis2.context.externalize
Class SafeObjectOutputStream

    java.lang.Object
      org.apache.axis2.context.externalize.SafeObjectOutputStream

All Implemented Interfaces:
  DataOutput, ObjectOutput, ObjectStreamConstants, ExternalizeConstants

    public class SafeObjectOutputStream

extends Object
implements ObjectOutput, ObjectStreamConstants, ExternalizeConstants

A SafeObjectOutputStream provides extra mechanisms to ensure that objects can be safely serialized to the ObjectOutput. If an Object is written to a normal ObjectOutput, the ObjectOutput is left in an unknown state if a NotSerializableException occurs. The SafeObjectOutputStream does some additonal checking to ensure that the Object can be safely written. If the Object is suspicious, it is first written to a buffer to ensure that the underlying ObjectOutput is not corrupted. In addition, SafeObjectOutputStream provides extra methods to write containers of Objects. For example the writeMap object will write the key and value pairs that are can be serialized.

See Also:
  `SafeObjectInputStream`

Field Summary
`static Hashtable` | `notSerializableList`

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`

Fields inherited from interface org.apache.axis2.context.externalize.ExternalizeConstants
`ACTIVE_OBJECT, EMPTY_MARKER, EMPTY_OBJECT, LAST_ENTRY, OBJ_RESTORE_PROBLEM, OBJ_SAVE_PROBLEM, UNSUPPORTED_REVID, UNSUPPORTED_SUID`

Method Summary
`void` | `close()`
`void` | `defaultWriteObject()`
`boolean` | `equals(Object o)`
`void` | `flush()`
`int` | `hashCode()`
`static SafeObjectOutputStream` | `install(ObjectOutput out)` Add the SafeOutputStream if necessary.
`ObjectOutputStream.PutField` | `putFields()`
`void` | `reset()`
`String` | `toString()`
`void` | `useProtocolVersion(int version)`
`void` | `write(byte[] buf)`
`void` | `write(byte[] buf, int off, int len)`
`void` | `write(int val)`
`void` | `writeBoolean(boolean val)`
`void` | `writeByte(int val)`
`void` | `writeBytes(String str)`
`void` | `writeChar(int val)`
`void` | `writeChars(String str)`
`void` | `writeDouble(double val)`
`void` | `writeFields()`
`void` | `writeFloat(float val)`
`void` | `writeInt(int val)`
`boolean` | `writeItem(Object obj, boolean isSafe)` Writes pair of objects to the stream.
`boolean` | `writeList(List al)` Write a list.
`void` | `writeLong(long val)`
`boolean` | `writeMap(Map map)` Write a map FORMAT for null map EMPTY_OBJECT FORMAT for non-empty map ACTIVE_OBJECT for each contained key value pair writePair EMPTY_OBJECT (indicates end of the list
`void` | `writeObject(Object obj)`
`boolean` | `writePair(Object obj1, boolean isSafe1, Object obj2, boolean isSafe2)` Writes pair of objects to the stream.
`void` | `writeShort(int val)`
`void` | `writeUTF(String str)`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### notSerializableList

    public static final Hashtable notSerializableList

Method Detail

### install

    public static SafeObjectOutputStream install(ObjectOutput out)
                                          throws IOException

  Add the SafeOutputStream if necessary.

  Parameters:
    `out` - Current ObjectOutput
  Returns:
  Throws:
    `IOException`

### close

    public void close()
               throws IOException

  Specified by:
    `close` in interface `ObjectOutput`
  Throws:
    `IOException`

### defaultWriteObject

    public void defaultWriteObject()
                            throws IOException

  Throws:
    `IOException`

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### flush

    public void flush()
               throws IOException

  Specified by:
    `flush` in interface `ObjectOutput`
  Throws:
    `IOException`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### putFields

    public ObjectOutputStream.PutField putFields()
                                          throws IOException

  Throws:
    `IOException`

### reset

    public void reset()
               throws IOException

  Throws:
    `IOException`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### useProtocolVersion

    public void useProtocolVersion(int version)
                            throws IOException

  Throws:
    `IOException`

### write

    public void write(byte[] buf,
                      int off,
                      int len)
               throws IOException

  Specified by:
    `write` in interface `DataOutput`
  Specified by:
    `write` in interface `ObjectOutput`
  Throws:
    `IOException`

### write

    public void write(byte[] buf)
               throws IOException

  Specified by:
    `write` in interface `DataOutput`
  Specified by:
    `write` in interface `ObjectOutput`
  Throws:
    `IOException`

### write

    public void write(int val)
               throws IOException

  Specified by:
    `write` in interface `DataOutput`
  Specified by:
    `write` in interface `ObjectOutput`
  Throws:
    `IOException`

### writeBoolean

    public void writeBoolean(boolean val)
                      throws IOException

  Specified by:
    `writeBoolean` in interface `DataOutput`
  Throws:
    `IOException`

### writeByte

    public void writeByte(int val)
                   throws IOException

  Specified by:
    `writeByte` in interface `DataOutput`
  Throws:
    `IOException`

### writeBytes

    public void writeBytes(String str)
                    throws IOException

  Specified by:
    `writeBytes` in interface `DataOutput`
  Throws:
    `IOException`

### writeChar

    public void writeChar(int val)
                   throws IOException

  Specified by:
    `writeChar` in interface `DataOutput`
  Throws:
    `IOException`

### writeChars

    public void writeChars(String str)
                    throws IOException

  Specified by:
    `writeChars` in interface `DataOutput`
  Throws:
    `IOException`

### writeDouble

    public void writeDouble(double val)
                     throws IOException

  Specified by:
    `writeDouble` in interface `DataOutput`
  Throws:
    `IOException`

### writeFields

    public void writeFields()
                     throws IOException

  Throws:
    `IOException`

### writeFloat

    public void writeFloat(float val)
                    throws IOException

  Specified by:
    `writeFloat` in interface `DataOutput`
  Throws:
    `IOException`

### writeInt

    public void writeInt(int val)
                  throws IOException

  Specified by:
    `writeInt` in interface `DataOutput`
  Throws:
    `IOException`

### writeLong

    public void writeLong(long val)
                   throws IOException

  Specified by:
    `writeLong` in interface `DataOutput`
  Throws:
    `IOException`

### writeObject

    public void writeObject(Object obj)
                     throws IOException

  Specified by:
    `writeObject` in interface `ObjectOutput`
  Throws:
    `IOException`

### writeShort

    public void writeShort(int val)
                    throws IOException

  Specified by:
    `writeShort` in interface `DataOutput`
  Throws:
    `IOException`

### writeUTF

    public void writeUTF(String str)
                  throws IOException

  Specified by:
    `writeUTF` in interface `DataOutput`
  Throws:
    `IOException`

### writeMap

    public boolean writeMap(Map map)
                     throws IOException

  Write a map FORMAT for null map EMPTY_OBJECT FORMAT for non-empty map ACTIVE_OBJECT for each contained key value pair writePair EMPTY_OBJECT (indicates end of the list

  Parameters:
    `ll` -
  Returns:
  Throws:
    `IOException`

### writeList

    public boolean writeList(List al)
                      throws IOException

  Write a list. FORMAT for null list EMPTY_OBJECT FORMAT for non-empty list ACTIVE_OBJECT for each contained object ACTOVE_OBJECT writeObject EMPTY_OBJECT (indicates end of the list

  Parameters:
    `ll` -
  Returns:
  Throws:
    `IOException`

### writePair

    public boolean writePair(Object obj1,
                             boolean isSafe1,
                             Object obj2,
                             boolean isSafe2)
                      throws IOException

  Writes pair of objects to the stream. If the objects are known (apriori) to be completely serializable they are "safe". Safe objects are written directly to the stream. Objects that are not known are to be safe are tested for safety and only written if they are deemed safe. Unsafe objects are not written. Note: The java.io.ObjectOutputStream is left in an unrecoverable state if any object written to it causes a serialization error. So please use the isSafe parameter wisely FORMAT for non-serializable key/value pair nothing is written FORMAT for safe serializable key/value pair ACTIVE_OBJECT FORM_OBJECT Object FORMAT for other serializable key/value pair ACTIVE_OBJECT FORM_BYTE length of bytes bytes representing the object

  Parameters:
    `obj1` -
    `isSafe1` - true if you know that object can be safely serialized. false if the object needs to be tested for serialization.
    `obj2` -
    `isSafe2` - true if you know that object can be safely serialized. false if the object needs to be tested for serialization.
  Throws:
    `IOException`

### writeItem

    public boolean writeItem(Object obj,
                             boolean isSafe)
                      throws IOException

  Writes pair of objects to the stream. If the objects are known (apriori) to be completely serializable they are "safe". Safe objects are written directly to the stream. Objects that are not known are to be safe are tested for safety and only written if they are deemed safe. Unsafe objects are not written. Note: The java.io.ObjectOutputStream is left in an unrecoverable state if any object written to it causes a serialization error. So please use the isSafe parameter wisely FORMAT for non-serializable key/value pair nothing is written FORMAT for safe serializable key/value pair ACTIVE_OBJECT FORM_OBJECT Object FORMAT for other serializable key/value pair ACTIVE_OBJECT FORM_BYTE length of bytes bytes representing the object

  Parameters:
    `obj1` -
    `isSafe1` - true if you know that object can be safely serialized. false if the object needs to be tested for serialization.
    `obj2` -
    `isSafe2` - true if you know that object can be safely serialized. false if the object needs to be tested for serialization.
  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2011 The Apache Software Foundation. All Rights Reserved.