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.
-
host
-
-
in
-
-
out
-
-
port
-
-
socket
-
-
wait
-
-
DeferredIO(MarshallInput, MarshallOutput, Session)
-
-
DeferredIO(Socket, Session)
-
-
DeferredIO(String, int, boolean, Session)
-
-
DeferredIO(String, int, Session)
-
-
DeferredIO(String, Session)
-
-
available()
-
-
checkConnection()
-
-
close()
-
-
connect()
- Make the connection.
-
copy(Object)
-
-
flush()
-
-
getSession()
-
-
getUnderlyingSocket()
-
-
hostname()
- Return the host name
-
isConnected()
-
-
makeStreams()
-
-
makeStreams(MarshallInput, MarshallOutput)
-
-
portNumber()
- Return the port number.
-
read()
-
-
read(byte[])
-
-
read(byte[], int, int)
-
-
readBoolean()
-
-
readByte()
-
-
readChar()
-
-
readDouble()
-
-
readFloat()
-
-
readFully(byte[])
-
-
readFully(byte[], int, int)
-
-
readInt()
-
-
readLine()
-
-
readLong()
-
-
readObject()
-
-
readObject(Object)
-
-
readProperties()
-
-
readShort()
-
-
readUnsignedByte()
-
-
readUnsignedShort()
-
-
readUTF()
-
-
setPort(int)
- Set the port, and wake up sleeping threads.
-
skip(long)
-
-
skipBytes(int)
-
-
startCaptureInput(MarshallOutput)
-
-
startCaptureOutput(MarshallOutput)
-
-
startReplacingSpecifiables()
-
-
startResolvingSpecifiables()
-
-
stop()
-
-
stopReplacingSpecifiables()
-
-
stopResolvingSpecifiables()
-
-
waitForConnection()
-
-
wakeUp()
- Wake up sleeping threads.
-
write(byte[])
-
-
write(byte[], int, int)
-
-
write(int)
- These are all routines which implement MarshallInput and MarshallOutput.
-
writeArrayBuffer(ByteArrayOutputStream)
-
-
writeBoolean(boolean)
-
-
writeByte(int)
-
-
writeBytes(String)
-
-
writeChar(int)
-
-
writeChars(String)
-
-
writeDouble(double)
-
-
writeFloat(float)
-
-
writeInt(int)
-
-
writeLong(long)
-
-
writeObject(Object)
-
-
writeProperties(Properties)
-
-
writeShort(int)
-
-
writeUTF(String)
-
in
protected SplitterMIStr in
out
protected SplitterMOStr out
host
protected String host
port
protected int port
wait
protected boolean wait
socket
protected Socket socket
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
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
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
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
DeferredIO
public DeferredIO(MarshallInput in,
MarshallOutput out,
Session aSession)
getUnderlyingSocket
public Socket getUnderlyingSocket()
setPort
public synchronized void setPort(int port)
- Set the port, and wake up sleeping threads.
wakeUp
public synchronized void wakeUp()
- Wake up sleeping threads.
hostname
public String hostname()
- Return the host name
portNumber
public int portNumber()
- Return the port number.
isConnected
public boolean isConnected()
checkConnection
public synchronized void checkConnection() throws IOException
waitForConnection
public boolean waitForConnection()
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.
makeStreams
protected boolean makeStreams()
makeStreams
protected boolean makeStreams(MarshallInput localInput,
MarshallOutput localOutput)
getSession
public Session getSession()
- Returns:
- the session
stop
public void stop()
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
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.
write
public void write(byte b[]) throws IOException
write
public void write(byte b[],
int off,
int len) throws IOException
writeBoolean
public void writeBoolean(boolean v) throws IOException
writeByte
public void writeByte(int v) throws IOException
writeShort
public void writeShort(int v) throws IOException
writeChar
public void writeChar(int v) throws IOException
writeInt
public void writeInt(int v) throws IOException
writeLong
public void writeLong(long v) throws IOException
writeFloat
public void writeFloat(float v) throws IOException
writeDouble
public void writeDouble(double v) throws IOException
writeBytes
public void writeBytes(String s) throws IOException
writeChars
public void writeChars(String s) throws IOException
writeUTF
public void writeUTF(String str) throws IOException
writeObject
public void writeObject(Object obj) throws IOException
writeArrayBuffer
public void writeArrayBuffer(ByteArrayOutputStream b) throws IOException
writeProperties
public void writeProperties(Properties p) throws IOException
flush
public void flush() throws IOException
stopReplacingSpecifiables
public void stopReplacingSpecifiables()
startReplacingSpecifiables
public void startReplacingSpecifiables()
stopResolvingSpecifiables
public void stopResolvingSpecifiables()
startResolvingSpecifiables
public void startResolvingSpecifiables()
available
public int available() throws IOException
read
public int read() throws IOException
read
public int read(byte b[]) throws IOException
read
public int read(byte b[],
int off,
int len) throws IOException
skip
public long skip(long n) throws IOException
close
public void close() throws IOException
readFully
public void readFully(byte b[]) throws IOException
readFully
public void readFully(byte b[],
int off,
int len) throws IOException
skipBytes
public int skipBytes(int n) throws IOException
readBoolean
public boolean readBoolean() throws IOException
readByte
public byte readByte() throws IOException
readUnsignedByte
public int readUnsignedByte() throws IOException
readShort
public short readShort() throws IOException
readUnsignedShort
public int readUnsignedShort() throws IOException
readChar
public char readChar() throws IOException
readInt
public int readInt() throws IOException
readLong
public long readLong() throws IOException
readFloat
public float readFloat() throws IOException
readDouble
public double readDouble() throws IOException
readLine
public String readLine() throws IOException
readUTF
public String readUTF() throws IOException
readObject
public Object readObject() throws ClassNotFoundException, IOException
readObject
public Object readObject(Object parent) throws ClassNotFoundException, IOException
readProperties
public Properties readProperties() throws IOException
startCaptureOutput
public void startCaptureOutput(MarshallOutput osRecorder)
- Parameters:
- osRecorder - the recorder
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