|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.asterisk.io.impl.SocketConnectionFacadeImpl
public class SocketConnectionFacadeImpl
Default implementation of the SocketConnectionFacade interface using java.io.
Constructor Summary | |
---|---|
SocketConnectionFacadeImpl(java.lang.String host,
int port)
|
|
SocketConnectionFacadeImpl(java.lang.String host,
int port,
int timeout)
|
Method Summary | |
---|---|
void |
close()
Closes the socket connection including its input and output stream and frees all associated ressources. When calling close() any Thread currently blocked by a call to readLine() will be unblocked and receive an IOException. |
void |
flush()
Flushes the socket connection, that is sends any buffered but yet unsent data. |
java.net.InetAddress |
getLocalAddress()
Returns the local address this socket connection. |
int |
getLocalPort()
Returns the local port of this socket connection. |
java.net.InetAddress |
getRemoteAddress()
Returns the remote address of this socket connection. |
int |
getRemotePort()
Returns the remote port of this socket connection. |
boolean |
isConnected()
Returns the connection state of the socket. |
java.lang.String |
readLine()
Reads a line of text from the socket connection. |
void |
write(java.lang.String s)
Sends a given String to the socket connection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SocketConnectionFacadeImpl(java.lang.String host, int port) throws java.io.IOException
java.io.IOException
public SocketConnectionFacadeImpl(java.lang.String host, int port, int timeout) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public java.lang.String readLine() throws java.io.IOException
SocketConnectionFacade
readLine
in interface SocketConnectionFacade
java.io.IOException
- if the connection has been closed.public void write(java.lang.String s) throws java.io.IOException
SocketConnectionFacade
write
in interface SocketConnectionFacade
s
- the String to send.
java.io.IOException
- if the String cannot be sent, maybe because the
connection has already been closed.public void flush() throws java.io.IOException
SocketConnectionFacade
flush
in interface SocketConnectionFacade
java.io.IOException
- if the connection cannot be flushed.public void close() throws java.io.IOException
SocketConnectionFacade
close
in interface SocketConnectionFacade
java.io.IOException
- if the socket connection cannot be closed.public boolean isConnected()
SocketConnectionFacade
isConnected
in interface SocketConnectionFacade
true
if the socket successfuly connected to a
serverpublic java.net.InetAddress getLocalAddress()
SocketConnectionFacade
getLocalAddress
in interface SocketConnectionFacade
public int getLocalPort()
SocketConnectionFacade
getLocalPort
in interface SocketConnectionFacade
public java.net.InetAddress getRemoteAddress()
SocketConnectionFacade
getRemoteAddress
in interface SocketConnectionFacade
public int getRemotePort()
SocketConnectionFacade
getRemotePort
in interface SocketConnectionFacade
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |