All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.habanero.DeferredIO

java.lang.Object
   |
   +----ncsa.habanero.DeferredIO

public class DeferredIO
extends Object
implements MarshallInput, MarshallOutput
This class acts as both a MarshallInput and a MarshallOutput. Its main purpose is to defer actually making a connection until something is actually written or read. It is created with a host name and port number, but creating the underlying socket is deferred until the first read or write. It can be created without a port, in which case reads or writes will block until a port is specified.


Variable Index

 o host
 o in
 o out
 o port
 o socket
 o wait

Constructor Index

 o DeferredIO(MarshallInput, MarshallOutput, Session)
 o DeferredIO(Socket, Session)
 o DeferredIO(String, int, boolean, Session)
 o DeferredIO(String, int, Session)
 o DeferredIO(String, Session)

Method Index

 o available()
 o checkConnection()
 o close()
 o connect()
Make the connection.
 o copy(Object)
 o flush()
 o getSession()
 o getUnderlyingSocket()
 o hostname()
Return the host name
 o isConnected()
 o makeStreams()
 o makeStreams(MarshallInput, MarshallOutput)
 o portNumber()
Return the port number.
 o read()
 o read(byte[])
 o read(byte[], int, int)
 o readBoolean()
 o readByte()
 o readChar()
 o readDouble()
 o readFloat()
 o readFully(byte[])
 o readFully(byte[], int, int)
 o readInt()
 o readLine()
 o readLong()
 o readObject()
 o readObject(Object)
 o readProperties()
 o readShort()
 o readUnsignedByte()
 o readUnsignedShort()
 o readUTF()
 o setPort(int)
Set the port, and wake up sleeping threads.
 o skip(long)
 o skipBytes(int)
 o startCaptureInput(MarshallOutput)
 o startCaptureOutput(MarshallOutput)
 o startReplacingSpecifiables()
 o startResolvingSpecifiables()
 o stop()
 o stopReplacingSpecifiables()
 o stopResolvingSpecifiables()
 o waitForConnection()
 o wakeUp()
Wake up sleeping threads.
 o write(byte[])
 o write(byte[], int, int)
 o write(int)
These are all routines which implement MarshallInput and MarshallOutput.
 o writeArrayBuffer(ByteArrayOutputStream)
 o writeBoolean(boolean)
 o writeByte(int)
 o writeBytes(String)
 o writeChar(int)
 o writeChars(String)
 o writeDouble(double)
 o writeFloat(float)
 o writeInt(int)
 o writeLong(long)
 o writeObject(Object)
 o writeProperties(Properties)
 o writeShort(int)
 o writeUTF(String)

Variables

 o in
 protected SplitterMIStr in
 o out
 protected SplitterMOStr out
 o host
 protected String host
 o port
 protected int port
 o wait
 protected boolean wait
 o socket
 protected Socket socket

Constructors

 o DeferredIO
 public DeferredIO(String host,
                   int port,
                   Session aSession)
Parameters:
host - the host string
port - the port number
aSession - the session that this is associated with
Returns:
Construct this with a host name and port number
 o DeferredIO
 public DeferredIO(String host,
                   Session aSession)
Parameters:
host - the host string
aSession - the session that this is associated with
Returns:
Construct this with a host name only Construct this with a host name only
 o DeferredIO
 public DeferredIO(String host,
                   int port,
                   boolean doWait,
                   Session aSession)
Parameters:
host - the host string
port - the port number
aSession - the session that this is associated with
Returns:
Construct this with a host name and port number and if we should wait
 o DeferredIO
 public DeferredIO(Socket connection,
                   Session aSession)
Parameters:
connection - the socket that is already connected
aSession - the session that this is associated with
Returns:
Construct this with a host name and port number and if we should wait
 o DeferredIO
 public DeferredIO(MarshallInput in,
                   MarshallOutput out,
                   Session aSession)

Methods

 o getUnderlyingSocket
 public Socket getUnderlyingSocket()
 o setPort
 public synchronized void setPort(int port)
Set the port, and wake up sleeping threads.

 o wakeUp
 public synchronized void wakeUp()
Wake up sleeping threads.

 o hostname
 public String hostname()
Return the host name

 o portNumber
 public int portNumber()
Return the port number.

 o isConnected
 public boolean isConnected()
 o checkConnection
 public synchronized void checkConnection() throws IOException
 o waitForConnection
 public boolean waitForConnection()
 o connect
 public synchronized boolean connect()
Make the connection. Try to create a socket to the given host and port. The host might contain both numeric and string data, so use a StringTokenizer to check both. When the socket is created, get a MarshallOutputStream and a MarshallInputStream from it.

 o makeStreams
 protected boolean makeStreams()
 o makeStreams
 protected boolean makeStreams(MarshallInput localInput,
                               MarshallOutput localOutput)
 o getSession
 public Session getSession()
Returns:
the session
 o stop
 public void stop()
 o copy
 public void copy(Object src) throws IllegalArgumentException
Parameters:
src - the source
Returns:
copies the state from src into the current object
Throws: IllegalArgumentException
if unknown
 o write
 public void write(int b) throws IOException
These are all routines which implement MarshallInput and MarshallOutput. They all call connect() first if the connection has not yet been made.

 o write
 public void write(byte b[]) throws IOException
 o write
 public void write(byte b[],
                   int off,
                   int len) throws IOException
 o writeBoolean
 public void writeBoolean(boolean v) throws IOException
 o writeByte
 public void writeByte(int v) throws IOException
 o writeShort
 public void writeShort(int v) throws IOException
 o writeChar
 public void writeChar(int v) throws IOException
 o writeInt
 public void writeInt(int v) throws IOException
 o writeLong
 public void writeLong(long v) throws IOException
 o writeFloat
 public void writeFloat(float v) throws IOException
 o writeDouble
 public void writeDouble(double v) throws IOException
 o writeBytes
 public void writeBytes(String s) throws IOException
 o writeChars
 public void writeChars(String s) throws IOException
 o writeUTF
 public void writeUTF(String str) throws IOException
 o writeObject
 public void writeObject(Object obj) throws IOException
 o writeArrayBuffer
 public void writeArrayBuffer(ByteArrayOutputStream b) throws IOException
 o writeProperties
 public void writeProperties(Properties p) throws IOException
 o flush
 public void flush() throws IOException
 o stopReplacingSpecifiables
 public void stopReplacingSpecifiables()
 o startReplacingSpecifiables
 public void startReplacingSpecifiables()
 o stopResolvingSpecifiables
 public void stopResolvingSpecifiables()
 o startResolvingSpecifiables
 public void startResolvingSpecifiables()
 o available
 public int available() throws IOException
 o read
 public int read() throws IOException
 o read
 public int read(byte b[]) throws IOException
 o read
 public int read(byte b[],
                 int off,
                 int len) throws IOException
 o skip
 public long skip(long n) throws IOException
 o close
 public void close() throws IOException
 o readFully
 public void readFully(byte b[]) throws IOException
 o readFully
 public void readFully(byte b[],
                       int off,
                       int len) throws IOException
 o skipBytes
 public int skipBytes(int n) throws IOException
 o readBoolean
 public boolean readBoolean() throws IOException
 o readByte
 public byte readByte() throws IOException
 o readUnsignedByte
 public int readUnsignedByte() throws IOException
 o readShort
 public short readShort() throws IOException
 o readUnsignedShort
 public int readUnsignedShort() throws IOException
 o readChar
 public char readChar() throws IOException
 o readInt
 public int readInt() throws IOException
 o readLong
 public long readLong() throws IOException
 o readFloat
 public float readFloat() throws IOException
 o readDouble
 public double readDouble() throws IOException
 o readLine
 public String readLine() throws IOException
 o readUTF
 public String readUTF() throws IOException
 o readObject
 public Object readObject() throws ClassNotFoundException, IOException
 o readObject
 public Object readObject(Object parent) throws ClassNotFoundException, IOException
 o readProperties
 public Properties readProperties() throws IOException
 o startCaptureOutput
 public void startCaptureOutput(MarshallOutput osRecorder)
Parameters:
osRecorder - the recorder
 o startCaptureInput
 public void startCaptureInput(MarshallOutput osRecorder)
Parameters:
osRecorder - the recorder
Returns:
starts writing all input values to the file osRecorder

All Packages  Class Hierarchy  This Package  Previous  Next  Index