NetSocket.NetSocketFactory
Modifier and Type | Field and Description |
---|---|
private NetSocket |
socket
Underlying NetSocket implementation
|
Constructor and Description |
---|
LoggingNetSocket(NetSocket socket)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addSessionListener(SessionListener sessionListener)
Adds a session listener.
|
void |
close()
Closes the socket.
|
void |
flush()
Flush the output if applicable
|
java.net.InetAddress |
getLocalAddr()
Access the address of the local system, through which we are connecting.
|
java.net.InetSocketAddress |
getLocalSockAddr()
Access the address of the local system, through which we are connecting.
|
java.net.InetAddress |
getRemoteAddr()
Access the address of the remote system, to which we are connecting.
|
java.net.InetSocketAddress |
getRemoteSockAddr()
Access the address of the remote system, to which we are connecting.
|
javax.net.ssl.SSLSession |
getSession()
Gets the SSL session.
|
java.util.List<SessionListener> |
getSessionListeners()
Gets the list with added session listeners.
|
boolean |
isClosed()
Reports if the socket is closed (and thus can no longer be used).
|
byte[] |
read()
Read the next portion of raw data (byte array) to the output
|
boolean |
readBoolean()
Read the boolean from the input
|
void |
readBytes(byte[] bytes)
Read the byte sequence from the input
|
int |
readInt()
Read the integer from the input
|
java.lang.String |
readUTF()
Read the UTF string from the input
|
void |
write(byte[] data)
Write byte array to the output
|
void |
writeBoolean(boolean val)
Write a boolean to the output
|
void |
writeBytes(byte[] bytes)
Write a byte sequence to the output
|
void |
writeInt(int val)
Write an integer to the output
|
void |
writeUTF(java.lang.String val)
Write an UTF String to the output
|
private final NetSocket socket
public LoggingNetSocket(NetSocket socket)
socket
- underlying NetSocket implementationpublic javax.net.ssl.SSLSession getSession()
getSession
in interface NetSocket
null
if the socket is not
secure.public boolean isClosed()
public java.net.InetAddress getLocalAddr()
getLocalAddr
in interface NetSocket
public java.net.InetSocketAddress getLocalSockAddr()
getLocalSockAddr
in interface NetSocket
public java.net.InetAddress getRemoteAddr()
getRemoteAddr
in interface NetSocket
public java.net.InetSocketAddress getRemoteSockAddr()
getRemoteSockAddr
in interface NetSocket
public java.util.List<SessionListener> getSessionListeners()
null
if none has
been added.getSessionListeners
in interface NetSocket
public void addSessionListener(SessionListener sessionListener)
addSessionListener
in interface NetSocket
sessionListener
- A session listener to be added.public void flush() throws java.io.IOException
public void write(byte[] data) throws java.io.IOException
public byte[] read() throws java.io.IOException
public int readInt() throws java.io.IOException
public void writeInt(int val) throws java.io.IOException
public void writeBytes(byte[] bytes) throws java.io.IOException
writeBytes
in interface NetSocket
bytes
- byte sequence to be writtenjava.io.IOException
- on errorpublic void readBytes(byte[] bytes) throws java.io.IOException
public void writeBoolean(boolean val) throws java.io.IOException
writeBoolean
in interface NetSocket
val
- boolean data to be writtenjava.io.IOException
- on errorpublic boolean readBoolean() throws java.io.IOException
readBoolean
in interface NetSocket
java.io.IOException
- on errorpublic java.lang.String readUTF() throws java.io.IOException