public class NetSocketWrapper extends NetSocketBase implements NetSocket
NetSocket.NetSocketFactory| Modifier and Type | Field and Description |
|---|---|
private java.io.DataInputStream |
dataInp
Data input stream.
|
private java.io.DataOutputStream |
dataOut
Data output stream.
|
private javax.net.ssl.SSLSession |
session
SSL session.
|
private java.net.Socket |
socket
Embedded socket which may or may not be secure.
|
LOG, TRACE_LMBUF_SIZE, FACTORY, handshakeTimeout, LOG| Constructor and Description |
|---|
NetSocketWrapper(java.net.Socket socket)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the socket.
|
void |
flush()
Flush the output
|
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.
|
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
|
addSessionListener, getSessionListenersclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddSessionListener, getSessionListeners, tracef, tracelnprivate final java.net.Socket socket
private final javax.net.ssl.SSLSession session
private final java.io.DataInputStream dataInp
private final java.io.DataOutputStream dataOut
public NetSocketWrapper(java.net.Socket socket)
throws java.io.IOException
socket - A connected socket to embed into this class. This may be a
secure socket but it is not required.java.io.IOException - If one of the streams being built on top of the socket throws
the same exception.public javax.net.ssl.SSLSession getSession()
getSession in interface NetSocketnull if the socket is not
secure.public boolean isClosed()
public java.net.InetAddress getLocalAddr()
getLocalAddr in interface NetSocketpublic java.net.InetSocketAddress getLocalSockAddr()
getLocalSockAddr in interface NetSocketpublic java.net.InetAddress getRemoteAddr()
getRemoteAddr in interface NetSocketpublic java.net.InetSocketAddress getRemoteSockAddr()
getRemoteSockAddr in interface NetSocketpublic 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 NetSocketbytes - 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 NetSocketval - boolean data to be writtenjava.io.IOException - on errorpublic boolean readBoolean()
throws java.io.IOException
readBoolean in interface NetSocketjava.io.IOException - on errorpublic java.lang.String readUTF()
throws java.io.IOException