java.io

Interface ObjectInput

All Superinterfaces:
DataInput
Known Implementing Classes:
ClassLoaderObjectInputStream, CodebaseAwareObjectInputStream, JRAbstractLRUVirtualizer.ClassLoaderAnnotationObjectInputStream, ObjectInputStream

public interface ObjectInput
extends DataInput

ObjectInput extends the DataInput interface to include the reading of objects. DataInput includes methods for the input of primitive types, ObjectInput extends that interface to include objects, arrays, and Strings.
Since:
JDK1.1
See Also:
InputStream, ObjectOutputStream, ObjectInputStream

Method Summary

int
available()
Returns the number of bytes that can be read without blocking.
void
close()
Closes the input stream.
int
read()
Reads a byte of data.
int
read(b[] )
Reads into an array of bytes.
int
read(b[] , int off, int len)
Reads into an array of bytes.
Object
readObject()
Read and return an object.
long
skip(long n)
Skips n bytes of input.

Methods inherited from interface java.io.DataInput

readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUTF, readUnsignedByte, readUnsignedShort, skipBytes

Method Details

available

public int available()
            throws IOException
Returns the number of bytes that can be read without blocking.
Returns:
the number of available bytes.
Throws:
IOException - If an I/O error has occurred.
Usages and Demos :

View More Examples of available()
   1: import java.io.InputStream;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectInputStream;
   4:         ...
   5:     {
   6:     private ObjectInput in;
   7: 
   8:         ...
   9:     SimpleObjectInputStream(ObjectInput in) 
  10:         throws java.io.IOException
  11:         ...
  12:     {
  13:         return in.available();

View Full Code Here

close

public void close()
            throws IOException
Closes the input stream. 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: import java.io.InputStream;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectInputStream;
   4:         ...
   5:             oo.writeObject(o);
   6:             oo.close();
   7:             logger.debug("Saved [" + o + "], id [" + id 
   8:         ...
   9:             InputStream is = new FileInputStream(f);
  10:             ObjectInput oi = new ObjectInputStream(is);
  11:             Object o = oi.readObject();
  12:         ...
  13:             oi.close();

View Full Code Here
   1: import java.io.InputStream;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectInputStream;
   4:         ...
   5:     {
   6:     private ObjectInput in;
   7: 
   8:         ...
   9:     SimpleObjectInputStream(ObjectInput in) 
  10:         throws java.io.IOException
  11:         ...
  12:     {
  13:         in.close();

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

View Full Code Here
   1: import java.io.ByteArrayOutputStream;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectInputStream;
   4:         ...
   5:             out.writeObject(p1);
   6:             out.close();
   7: 
   8:         ...
   9:             ObjectInput in = new ObjectInputStream(
  10:                 new ByteArrayInputStream(buffer.toByteArray())
  11:         ...
  12:             p2 = (PiePlot3D) in.readObject();
  13:             in.close();

View Full Code Here
   1: import java.io.ByteArrayOutputStream;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectInputStream;
   4:         ...
   5:             out.writeObject(g1);
   6:             out.close();
   7: 
   8:         ...
   9:             ObjectInput in = new ObjectInputStream(
  10:                 new ByteArrayInputStream(buffer.toByteArray())
  11:         ...
  12:             g2 = (DatasetGroup) in.readObject();
  13:             in.close();

View Full Code Here

read

public int read()
            throws IOException
Reads a byte of data. This method will block if no input is available.
Returns:
the byte read, or -1 if the end of the stream is reached.
Throws:
IOException - If an I/O error has occurred.
Usages and Demos :

View More Examples of read()
   1: import java.io.IOException;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectOutput;
   4:         ...
   5: 
   6:     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException 
   7:     {
   8:         ...
   9:         boolean rVal = in.read() == 1;
  10:         if(rVal)

View Full Code Here
   1: import java.io.IOException;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectOutput;
   4:         ...
   5:    
   6:    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
   7:    {
   8:         ...
   9:       type = in.read();
  10:       sourceId = in.readLong();

View Full Code Here
   1: import java.io.InputStream;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectInputStream;
   4:         ...
   5:     {
   6:     private ObjectInput in;
   7: 
   8:         ...
   9:     SimpleObjectInputStream(ObjectInput in) 
  10:         throws java.io.IOException
  11:         ...
  12:     {
  13:         return in.read();

View Full Code Here
   1: import java.io.IOException;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectOutput;
   4:         ...
   5:    
   6:    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
   7:    {
   8:         ...
   9:       type = in.read();
  10:       sourceId = in.readLong();

View Full Code Here
   1: import java.io.IOException;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectOutput;
   4:         ...
   5:    
   6:    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
   7:    {
   8:         ...
   9:       type = in.read();
  10:       sourceId = in.readLong();

View Full Code Here

read

public int read(b[] )
            throws IOException
Reads into an array of bytes. This method will block until some input is available.
Parameters:
Returns:
the actual number of bytes read, -1 is returned when the end of the stream is reached.
Throws:
IOException - If an I/O error has occurred.
Usages and Demos :

View More Examples of read(b[] )
   1: import java.io.InputStream;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectInputStream;
   4:         ...
   5:     {
   6:     private ObjectInput in;
   7: 
   8:         ...
   9:     SimpleObjectInputStream(ObjectInput in) 
  10:         throws java.io.IOException
  11:         ...
  12:     {
  13:         return in.read(b);

View Full Code Here
   1: import java.io.ObjectOutput;
   2: import java.io.ObjectInput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void readExternal(ObjectInput in) 
   7:         throws IOException, ClassNotFoundException
   8:         ...
   9:         if (array_len > 0)
  10:             in.read(global_id);
  11: 
  12:         ...
  13:         if (array_len > 0)
  14:             in.read(branch_id);

View Full Code Here
   1: import java.io.InputStream;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectOutput;
   4:         ...
   5:         synchronized (in) {
   6:             int nbRead = in.read(buffer);
   7:             if (-1 == nbRead) {
   8:         ...
   9:         }
  10:         public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  11:             sequence = in.readInt();

View Full Code Here
   1: import java.io.InputStream;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectOutput;
   4:         ...
   5:         {
   6:         return in.read(b);
   7:         }
   8:         ...
   9: 
  10:     public InputStream getObjectInputStream(ObjectInput in)
  11:         throws java.io.IOException, ClassNotFoundException

View Full Code Here
   1: import java.io.InputStream;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectOutput;
   4:         ...
   5:     {
   6:         return in.read(b);
   7:     }
   8:         ...
   9: 
  10:     public InputStream getObjectInputStream(ObjectInput in)
  11:         throws java.io.IOException, ClassNotFoundException

View Full Code Here

read

public int read(b[] ,
                int off,
                int len)
            throws IOException
Reads into an array of bytes. This method will block until some input is available.
Parameters:
off - the start offset of the data
len - the maximum number of bytes read
Returns:
the actual number of bytes read, -1 is returned when the end of the stream is reached.
Throws:
IOException - If an I/O error has occurred.
Usages and Demos :

View More Examples of read(b[] ,int off,int len)
   1: import java.io.InputStream;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectInputStream;
   4:         ...
   5:     {
   6:     private ObjectInput in;
   7: 
   8:         ...
   9:     SimpleObjectInputStream(ObjectInput in) 
  10:         throws java.io.IOException
  11:         ...
  12:     {
  13:         return in.read(b, off, len);

View Full Code Here
   1: import java.io.Externalizable;
   2: import java.io.ObjectInput;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     public void readExternal(ObjectInput in ) throws IOException {
   7:         int length = in.readInt();
   8:         ...
   9:         message = new byte[length];
  10:         in.read(message,0,length);
  11:     }

View Full Code Here
   1: 
   2: import java.io.ObjectInput;
   3: import java.io.Serializable;
   4:         ...
   5: 
   6:     public void readExternal(ObjectInput in) throws IOException,ClassNotFoundException {
   7:         reply = in.readBoolean();
   8:         ...
   9:         uuid = new byte[length];
  10:         in.read(uuid, 0, length);
  11:         length = in.readInt();
  12:         ...
  13:         rpcId = new byte[length];
  14:         in.read(rpcId, 0, length);

View Full Code Here
   1: import java.io.InputStream;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectOutput;
   4:         ...
   5:         {
   6:         return in.read(b, off, len);
   7:         }
   8:         ...
   9: 
  10:     public InputStream getObjectInputStream(ObjectInput in)
  11:         throws java.io.IOException, ClassNotFoundException

View Full Code Here
   1: import java.io.InputStream;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectOutput;
   4:         ...
   5:     {
   6:         return in.read(b, off, len);
   7:     }
   8:         ...
   9: 
  10:     public InputStream getObjectInputStream(ObjectInput in)
  11:         throws java.io.IOException, ClassNotFoundException

View Full Code Here

readObject

public Object readObject()
            throws ClassNotFoundException,
                   IOException
Read and return an object. The class that implements this interface defines where the object is "read" from.
Returns:
the object read from the stream
Throws:
ClassNotFoundException - If the class of a serialized object cannot be found.
IOException - If any of the usual Input/Output related exceptions occur.
Usages and Demos :

View More Examples of readObject()
   1: import java.io.IOException;
   2: import java.io.ObjectInput;
   3: 
   4:         ...
   5: public class ReloadableDeserializerImpl {
   6:     public Object readObject(ObjectInput input)
   7:             throws ClassNotFoundException, IOException {
   8:         ...
   9:         return input.readObject();
  10:     }

View Full Code Here
   1: import java.io.IOException;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectOutput;
   4:         ...
   5:     
   6:     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
   7:         ...
   8:     name=(String)in.readObject();
   9:     }

View Full Code Here
   1:   }
   2:   public void readExternal(ObjectInput in)throws IOException,ClassNotFoundException{
   3:         ...
   4:     name=(String)in.readObject();
   5:         ...
   6:     orders=(Set<Order4>)in.readObject();
   7:   }
   8:         ...
   9:   }
  10:   public void readExternal(ObjectInput in)throws IOException,ClassNotFoundException{

View Full Code Here
   1: import java.io.IOException;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectOutput;
   4:         ...
   5: 
   6:     public void readExternal(ObjectInput in)
   7:                       throws IOException, ClassNotFoundException {
   8:         ...
   9:         group_addr = (String) in.readObject();
  10:     }

View Full Code Here
   1: import java.io.IOException;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectOutput;
   4:         ...
   5: 
   6:     public void readExternal(ObjectInput in)
   7:                       throws IOException, ClassNotFoundException {
   8:         ...
   9:         channel_name = (String) in.readObject();
  10:     }

View Full Code Here

skip

public long skip(long n)
            throws IOException
Skips n bytes of input.
Parameters:
n - the number of bytes to be skipped
Returns:
the actual number of bytes skipped.
Throws:
IOException - If an I/O error has occurred.
Usages and Demos :

View More Examples of skip(long n)
   1: import java.io.InputStream;
   2: import java.io.ObjectInput;
   3: import java.io.ObjectInputStream;
   4:         ...
   5:     {
   6:     private ObjectInput in;
   7: 
   8:         ...
   9:     SimpleObjectInputStream(ObjectInput in) 
  10:         throws java.io.IOException
  11:         ...
  12:     {
  13:         return in.skip(n);

View Full Code Here