|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sapia.ubik.net.SocketConnection
public class SocketConnection
A Connection implemented through a Socket.
| Field Summary | |
|---|---|
protected TCPAddress |
_address
|
protected java.io.ObjectInputStream |
_is
|
protected long |
_lastReset
|
protected java.lang.ClassLoader |
_loader
|
protected java.io.ObjectOutputStream |
_os
|
protected long |
_resetInterval
|
protected java.net.Socket |
_sock
|
| Constructor Summary | |
|---|---|
SocketConnection(java.net.Socket sock)
|
|
SocketConnection(java.net.Socket sock,
java.lang.ClassLoader loader)
|
|
| Method Summary | |
|---|---|
void |
close()
Closes this connection. |
protected void |
doSend(java.lang.Object toSend,
java.io.ObjectOutputStream mos)
|
java.io.InputStream |
getInputStream()
Returns this instance's internal input stream. |
java.io.OutputStream |
getOuputStream()
Returns this instance's internal output stream. |
ServerAddress |
getServerAddress()
Returns "address" of the server with which this connection communicates. |
protected java.io.ObjectInputStream |
newInputStream(java.io.InputStream is,
java.lang.ClassLoader loader)
Template method internally called by this instance; the method should create an ObjectInputStream for the given parameters. |
protected java.io.ObjectOutputStream |
newOutputStream(java.io.OutputStream os,
java.lang.ClassLoader loader)
Template method internally called by this instance; the method should create an ObjectOutputStream for the given parameters. |
protected void |
readHeader(java.io.InputStream is,
java.lang.ClassLoader loader)
|
java.lang.Object |
receive()
Receives an object from the server with which this connection communicates. |
void |
send(java.lang.Object o)
Sends the given object to the server with which this connection communicates. |
void |
setResetInterval(long interval)
Sets the interval at which this instance calls the reset
method on the ObjectOutputStream that in uses internally for serializing
objects. |
protected void |
writeHeader(java.io.OutputStream os,
java.lang.ClassLoader loader)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.net.Socket _sock
protected TCPAddress _address
protected java.lang.ClassLoader _loader
protected java.io.ObjectInputStream _is
protected java.io.ObjectOutputStream _os
protected long _lastReset
protected long _resetInterval
| Constructor Detail |
|---|
public SocketConnection(java.net.Socket sock,
java.lang.ClassLoader loader)
public SocketConnection(java.net.Socket sock)
| Method Detail |
|---|
public void setResetInterval(long interval)
reset
method on the ObjectOutputStream that in uses internally for serializing
objects.
This instance performs the reset at every write, insuring that no stale
object is cached by the underlying ObjectOutputStream.
interval - the interval (in millis) at which this instance calls
the reset method of its ObjectOutputStream.
public void send(java.lang.Object o)
throws java.io.IOException,
java.rmi.RemoteException
Connection
send in interface Connectionjava.io.IOException
java.rmi.RemoteExceptionConnection.send(Object)
public java.lang.Object receive()
throws java.io.IOException,
java.lang.ClassNotFoundException,
java.rmi.RemoteException
Connection
receive in interface ConnectionObject.
java.io.IOException
java.lang.ClassNotFoundException
java.rmi.RemoteExceptionConnection.receive()public void close()
Connection
close in interface ConnectionConnection.close()public ServerAddress getServerAddress()
Connection
getServerAddress in interface ConnectionServerAddress.Connection.getServerAddress()
public java.io.InputStream getInputStream()
throws java.io.IOException
InputStream.
java.io.IOException
public java.io.OutputStream getOuputStream()
throws java.io.IOException
OutputStream.
java.io.IOException
protected java.io.ObjectOutputStream newOutputStream(java.io.OutputStream os,
java.lang.ClassLoader loader)
throws java.io.IOException
ObjectOutputStream for the given parameters.
os - the OutputStream that the returned stream should wrap.the - ClassLoader that this instance corresponds to.
ObjectOutputStream.
java.io.IOException - if a problem occurs creating the desired object.
protected java.io.ObjectInputStream newInputStream(java.io.InputStream is,
java.lang.ClassLoader loader)
throws java.io.IOException
ObjectInputStream for the given parameters.
The returned instance can use the passed in classloader to resolve the classes of the deserialized objects.
is - the InputStream that the returned stream should wrap.the - ClassLoader that this instance corresponds to.
ObjectInputStream.
java.io.IOException - if a problem occurs creating the desired object.ObjectInputStream.resolveClass(java.io.ObjectStreamClass)
protected void doSend(java.lang.Object toSend,
java.io.ObjectOutputStream mos)
throws java.io.IOException
java.io.IOException
protected void writeHeader(java.io.OutputStream os,
java.lang.ClassLoader loader)
throws java.io.IOException
java.io.IOException
protected void readHeader(java.io.InputStream is,
java.lang.ClassLoader loader)
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||