|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.universAAL.lddi.zwave.exporter.Server.ConnectionDataHandler
public class ConnectionDataHandler
Connection wrapper to be used with xSocket library.
Constructor Summary | |
---|---|
ConnectionDataHandler(org.xsocket.connection.INonBlockingConnection connection,
ISocketServerConnectionListener listener,
ISocketSeverProtocolDecoder protocolDecoder)
Constructor. |
Method Summary | |
---|---|
void |
close()
Closes the connection. |
void |
decode(byte[] newData)
Decodes incoming data. |
void |
errorDecoding(String errorDecoding)
Error produced while decoding data. |
org.xsocket.connection.INonBlockingConnection |
getConnection()
getConnectionSynchronized. |
int |
getConnectionReceivedPackets()
Gets the total number of received packets. |
int |
getConnectionSentPackets()
Gets the total number of sent packets. |
int |
getId()
Returns the connection identifier. |
ISocketServerConnectionListener |
getListener()
Returns the listener. |
InetAddress |
getRemoteAddress()
Returns the remote IP address. |
int |
getRemotePort()
Returns the remote port. |
boolean |
isConnectionClosed()
Returns true if the connections is closed. |
void |
onException(IOException ioe)
Exception raised while trying to write. |
void |
onWritten(int written)
Callback method that notifies that a packet has been sent. |
void |
packetReceived(Object pckt)
Method called by the protocol decoder when a new packet has been assembled. |
void |
setConnectionLister(ISocketServerConnectionListener listener)
Set the listener. |
void |
setId(int connectionId)
. |
void |
writeToConnection(ByteBuffer data)
Writes data to connection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConnectionDataHandler(org.xsocket.connection.INonBlockingConnection connection, ISocketServerConnectionListener listener, ISocketSeverProtocolDecoder protocolDecoder)
connection
- xSocket connection that wraps the socket channellistener
- connection listenerprotocolDecoder
- connection protocol decoderMethod Detail |
---|
public void close()
close
in interface Closeable
public void decode(byte[] newData)
newData
- incoming new datapublic int getConnectionReceivedPackets()
getConnectionReceivedPackets
in interface ISocketServerConnection
public int getConnectionSentPackets()
getConnectionSentPackets
in interface ISocketServerConnection
public int getId()
getId
in interface ISocketServerConnection
public boolean isConnectionClosed()
isConnectionClosed
in interface ISocketServerConnection
public void onException(IOException ioe)
onException
in interface org.xsocket.connection.IWriteCompletionHandler
ioe
- error while trying to write to the connection.public void onWritten(int written) throws IOException
onWritten
in interface org.xsocket.connection.IWriteCompletionHandler
written
- the size of the packet written
IOException
- error handling onWritten eventIWriteCompletionHandler.onWritten(int)
public void packetReceived(Object pckt)
packetReceived
in interface ISocketServerProtocolDecoderListener
pckt
- the new assembled packetpublic void setId(int connectionId)
setId
in interface ISocketServerConnection
connectionId
- integer used to identify the connection.public void writeToConnection(ByteBuffer data)
onWritten
is called after the packet has
been written.
writeToConnection
in interface ISocketServerConnection
data
- data to be writtenpublic InetAddress getRemoteAddress()
getRemoteAddress
in interface ISocketServerConnection
public org.xsocket.connection.INonBlockingConnection getConnection()
public void errorDecoding(String errorDecoding)
errorDecoding
in interface ISocketServerProtocolDecoderListener
errorDecoding
- .public ISocketServerConnectionListener getListener()
public void setConnectionLister(ISocketServerConnectionListener listener)
setConnectionLister
in interface ISocketServerConnection
listener
- listener.public int getRemotePort()
ISocketServerConnection
getRemotePort
in interface ISocketServerConnection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |