java.io

Interface ObjectOutput

All Superinterfaces:
DataOutput
Known Implementing Classes:
JRAbstractLRUVirtualizer.ClassLoaderAnnotationObjectOutputStream, ObjectOutputStream

public interface ObjectOutput
extends DataOutput

ObjectOutput extends the DataOutput interface to include writing of objects. DataOutput includes methods for output of primitive types, ObjectOutput extends that interface to include objects, arrays, and Strings.
Since:
JDK1.1
See Also:
InputStream, ObjectOutputStream, ObjectInputStream

Method Summary

void
close()
Closes the stream.
void
flush()
Flushes the stream.
void
write(b[] )
Writes an array of bytes.
void
write(b[] , int off, int len)
Writes a sub array of bytes.
void
write(int b)
Writes a byte.
void
writeObject(Object obj)
Write an object to the underlying storage or stream.

Methods inherited from interface java.io.DataOutput

write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF

Method Details

close

public void close()
            throws IOException
Closes the stream. This method must be called to release any resources associated with the stream.
Throws:
IOException - If an I/O error has occurred.
Usages and Demos :

View More Examples of close()
   1:         FileOutputStream f = new FileOutputStream("test");
   2:         ObjectOutput s = new ObjectOutputStream(f);
   3:         s.writeObject("Today");
   4:         ...
   5:     s.flush();
   6:     f.close();
   7:         ...
   8:     s.close();
   9:     }

View Full Code Here
   1:   }
   2:   public void writeExternal(ObjectOutput out)throws IOException{
   3:     System.out.println("run writeExternal");
   4:         ...
   5:     out.writeObject(seObj);
   6:     out.close();
   7:   }
   8: }

View Full Code Here
   1:   }
   2:   public void writeExternal(ObjectOutput out)throws IOException{
   3:     System.out.println("run writeExternal");
   4:         ...
   5:     out.writeObject(seObj);
   6:     out.close();
   7:   }
   8: }

View Full Code Here
   1: import java.io.ObjectInputStream;
   2: import java.io.ObjectOutput;
   3: import java.io.ObjectOutputStream;
   4:         ...
   5:             OutputStream os = new FileOutputStream(file);
   6:             ObjectOutput oo = new ObjectOutputStream(os);
   7:             oo.writeObject(o);
   8:         ...
   9:             oo.close();
  10:             logger.debug("Saved [" + o + "], id [" + id 
  11:         ...
  12:             Object o = oi.readObject();
  13:             oi.close();

View Full Code Here
   1: package org.cougaar.mts.base;
   2: import java.io.ObjectOutput;
   3: import java.io.ObjectOutputStream;
   4:         ...
   5:     static class SimpleObjectOutputStream extends ObjectOutputStream {
   6:     private ObjectOutput out;
   7: 
   8:         ...
   9:     SimpleObjectOutputStream(ObjectOutput out) 
  10:         throws java.io.IOException
  11:         ...
  12:     {
  13:         out.close();

View Full Code Here

flush

public void flush()
            throws IOException
Flushes the stream. This will write any buffered output bytes.
Throws:
IOException - If an I/O error has occurred.
Usages and Demos :

View More Examples of flush()
   1:         FileOutputStream f = new FileOutputStream("test");
   2:         ObjectOutput s = new ObjectOutputStream(f);
   3:         s.writeObject("Today");
   4:         ...
   5:         s.writeObject(new Date());
   6:     s.flush();
   7:     f.close();
   8:     s.close();
   9:     }

View Full Code Here
   1:          FileOutputStream f = new FileOutputStream("Saver.tmp");
   2:          ObjectOutput s = new ObjectOutputStream(f);
   3:          s.writeObject(b);
   4:         ...
   5:          s.flush();
   6:       }
   7:       catch (Exception e)
   8:       {

View Full Code Here
   1: package org.cougaar.mts.base;
   2: import java.io.ObjectOutput;
   3: import java.io.ObjectOutputStream;
   4:         ...
   5:     static class SimpleObjectOutputStream extends ObjectOutputStream {
   6:     private ObjectOutput out;
   7: 
   8:         ...
   9:     SimpleObjectOutputStream(ObjectOutput out) 
  10:         throws java.io.IOException
  11:         ...
  12:     {
  13:         out.flush();

View Full Code Here
   1: import java.io.ObjectInput;
   2: import java.io.ObjectOutput;
   3: import java.io.ObjectInputStream;
   4:         ...
   5:             FileOutputStream fo = new FileOutputStream("c:\\working\\css2parser\\stylesheets\\tmp");
   6:             ObjectOutput oo = new ObjectOutputStream(fo);
   7:             oo.writeObject(stylesheet);
   8:         ...
   9:             oo.flush();
  10:             

View Full Code Here
   1: public class LogSerializer implements LogListener {
   2:     private ObjectOutput mOut;
   3:     private LogEvent mCurrentEvent;
   4:         ...
   5: 
   6:     public LogSerializer(ObjectOutput out) {
   7:         mOut = out;
   8:         ...
   9:             mOut.writeObject(event);
  10:             mOut.flush();
  11:             mCurrentEvent = null;

View Full Code Here

write

public void write(b[] )
            throws IOException
Writes an array of bytes. This method will block until the bytes are actually written.
Specified by:
write in interface DataOutput
Parameters:
Throws:
IOException - If an I/O error has occurred.
Usages and Demos :

View More Examples of write(b[] )
   1: import java.io.ObjectInput;
   2: import java.io.ObjectOutput;
   3: 
   4:         ...
   5: 
   6:     public void writeExternal(ObjectOutput out) throws IOException 
   7:     {        
   8:         ...
   9:         {
  10:             out.write(1);
  11:             out.writeObject(m_rVal);
  12:         ...
  13:         {
  14:             out.write(0);

View Full Code Here
   1: import java.io.ObjectInput;
   2: import java.io.ObjectOutput;
   3: import java.util.ArrayList;
   4:         ...
   5: 
   6:     public void writeExternal(ObjectOutput out) throws IOException {
   7:         if (consumers != null) {
   8:         ...
   9:             out.write(consumers.size());
  10:             Iterator i = consumers.keySet().iterator();
  11:         ...
  12:         else
  13:             out.write(-1);

View Full Code Here
   1: 
   2: import java.io.ObjectOutput;
   3: import java.io.ObjectInput;
   4:         ...
   5: 
   6:     public final void writeExternal(ObjectOutput out) throws IOException
   7:     {
   8:         ...
   9:         {
  10:             out.write((byte) (0x80 | (len & 0xff)));
  11:         }
  12:         ...
  13:         {
  14:             out.write((byte) 0xA0);

View Full Code Here
   1: import java.io.InputStream;
   2: import java.io.ObjectOutput;
   3: import java.io.ObjectInput;
   4:         ...
   5: 
   6:     public void writeExternal(ObjectOutput out) throws IOException
   7:     {
   8:         ...
   9: 
  10:         out.write((utflen >>> 8) & 0xFF);
  11:         ...
  12:         out.write((utflen >>> 0) & 0xFF);

View Full Code Here

write

public void write(b[] ,
                  int off,
                  int len)
            throws IOException
Writes a sub array of bytes.
Specified by:
write in interface DataOutput
Parameters:
off - the start offset in the data
len - the number of bytes that are written
Throws:
IOException - If an I/O error has occurred.
Usages and Demos :

View More Examples of write(b[] ,int off,int len)
   1: package org.cougaar.mts.base;
   2: import java.io.ObjectOutput;
   3: import java.io.ObjectOutputStream;
   4:         ...
   5:     static class SimpleObjectOutputStream extends ObjectOutputStream {
   6:     private ObjectOutput out;
   7: 
   8:         ...
   9:     SimpleObjectOutputStream(ObjectOutput out) 
  10:         throws java.io.IOException
  11:         ...
  12:     {
  13:         out.write(b, off, len);

View Full Code Here
   1: import java.io.FilterOutputStream;
   2: import java.io.ObjectOutput;
   3: import java.io.OutputStream;
   4:         ...
   5:     {
   6:         out.write(b, off, len);
   7:         ...
   8:         other.write(b, off, len);
   9:     }
  10:         ...
  11: 
  12:     public OutputStream getObjectOutputStream(ObjectOutput out)

View Full Code Here
   1: import java.io.IOException;
   2: import java.io.ObjectOutput;
   3: import org.apache.catalina.tribes.util.Arrays;
   4:         ...
   5: 
   6:     public void writeExternal(ObjectOutput out) throws IOException {
   7:         out.writeBoolean(reply);
   8:         ...
   9:         out.writeInt(uuid.length);
  10:         out.write(uuid, 0, uuid.length);
  11:         out.writeInt(rpcId.length);
  12:         ...
  13:         out.write(rpcId, 0, rpcId.length);

View Full Code Here
   1: import java.io.ObjectInput;
   2: import java.io.ObjectOutput;
   3: 
   4:         ...
   5: 
   6:   public void writeExternal(ObjectOutput out) throws IOException {
   7:     int l = addressBytes.length;
   8:         ...
   9:     out.writeByte(l);
  10:     out.write(addressBytes,0,l);
  11:   }

View Full Code Here
   1: 
   2: import java.io.ObjectOutput;
   3: import java.io.ObjectInput;
   4:         ...
   5: 
   6:     public void writeExternal(ObjectOutput out) throws IOException
   7:     {
   8:         ...
   9:         out.writeInt(length);
  10:         out.write(array, offset, length);
  11:     }

View Full Code Here

write

public void write(int b)
            throws IOException
Writes a byte. This method will block until the byte is actually written.
Specified by:
write in interface DataOutput
Parameters:
b - the byte
Throws:
IOException - If an I/O error has occurred.
Usages and Demos :

View More Examples of write(int b)
   1: import java.io.ObjectInput;
   2: import java.io.ObjectOutput;
   3: 
   4:         ...
   5: 
   6:     public void writeExternal(ObjectOutput out) throws IOException 
   7:     {        
   8:         ...
   9:         {
  10:             out.write(1);
  11:             out.writeObject(m_rVal);
  12:         ...
  13:         {
  14:             out.write(0);

View Full Code Here
   1: import java.io.ObjectInput;
   2: import java.io.ObjectOutput;
   3: import java.util.ArrayList;
   4:         ...
   5: 
   6:     public void writeExternal(ObjectOutput out) throws IOException {
   7:         if (consumers != null) {
   8:         ...
   9:             out.write(consumers.size());
  10:             Iterator i = consumers.keySet().iterator();
  11:         ...
  12:         else
  13:             out.write(-1);

View Full Code Here
   1: 
   2: import java.io.ObjectOutput;
   3: import java.io.ObjectInput;
   4:         ...
   5: 
   6:     public final void writeExternal(ObjectOutput out) throws IOException
   7:     {
   8:         ...
   9:         {
  10:             out.write((byte) (0x80 | (len & 0xff)));
  11:         }
  12:         ...
  13:         {
  14:             out.write((byte) 0xA0);

View Full Code Here
   1: import java.io.InputStream;
   2: import java.io.ObjectOutput;
   3: import java.io.ObjectInput;
   4:         ...
   5: 
   6:     public void writeExternal(ObjectOutput out) throws IOException
   7:     {
   8:         ...
   9: 
  10:         out.write((utflen >>> 8) & 0xFF);
  11:         ...
  12:         out.write((utflen >>> 0) & 0xFF);

View Full Code Here

writeObject

public void writeObject(Object obj)
            throws IOException
Write an object to the underlying storage or stream. The class that implements this interface defines how the object is written.
Parameters:
obj - the object to be written
Throws:
IOException - Any of the usual Input/Output related exceptions.
Usages and Demos :

View More Examples of writeObject(Object obj)
   1:         FileOutputStream f = new FileOutputStream("test");
   2:         ObjectOutput s = new ObjectOutputStream(f);
   3:         ...
   4:         s.writeObject("Today");
   5:         s.writeObject(new Date());
   6:     s.flush();
   7:     f.close();

View Full Code Here
   1: import java.io.ObjectInput;
   2: import java.io.ObjectOutput;
   3: 
   4:         ...
   5: 
   6:     public void writeExternal(ObjectOutput out) throws IOException {
   7: 
   8:         ...
   9:         out.writeObject(file.getAbsolutePath());
  10:         out.writeInt(line);
  11:         ...
  12:         out.writeInt(column);
  13:         out.writeObject(_packageName);

View Full Code Here
   1: import java.io.ObjectInput;
   2: import java.io.ObjectOutput;
   3: import java.rmi.MarshalException;
   4:         ...
   5:           {
   6:             ObjectOutput out = call.getResultStream(true);
   7:           }
   8:         ...
   9:           {
  10:             ObjectOutput out = call.getResultStream(true);
  11:         ...
  12:             out.writeObject($result);

View Full Code Here
   1: import java.io.ObjectInput;
   2: import java.io.ObjectOutput;
   3: 
   4:         ...
   5: 
   6:     public void writeExternal(ObjectOutput out) throws IOException {
   7:     out.writeInt(_bitSize);
   8:         ...
   9:     out.writeInt(_mask);
  10:     out.writeObject(_bits);
  11:     out.flush();

View Full Code Here
   1: import java.io.IOException;
   2: import java.io.ObjectOutput;
   3: import java.io.ObjectStreamClass;
   4:         ...
   5: 
   6:     public void write(ObjectOutput out) throws IOException
   7:     {
   8:         ...
   9:         throw new IOException("PutField.write(ObjectOutput) - not supported for RMI/IIOP");
  10:     }
  11:         ...
  12:         {
  13:             out.writeObject(ValueType.getInstance(objVals[i].getClass()), objVals[i]);

View Full Code Here