public final class XSockets extends Object
| Modifier and Type | Method and Description |
|---|---|
static SocketChannel |
acceptSocketChannel(ServerSocketChannel serverSocketChannel) |
static ByteOrder |
byteOrder() |
static void |
closeChannel(NetworkChannel channel) |
static InetAddress |
localHostAddress()
Alias for
InetAddress.getLocalHost(). |
static InetSocketAddress |
localHostSocketAddress()
Creates a new
InetSocketAddress instance with localHostAddress() and port 0 (ephemeral port). |
static InetSocketAddress |
localHostSocketAddress(int port)
Creates a new
InetSocketAddress instance with localHostAddress() and the passed port value. |
static SocketChannel |
openChannel(InetSocketAddress address) |
static SocketChannel |
openChannelLocalhost() |
static SocketChannel |
openChannelLocalhost(int port) |
static ServerSocketChannel |
openServerSocketChannel(InetSocketAddress address) |
static int |
read(SocketChannel channel,
ByteBuffer buffer) |
static ByteBuffer |
read(SocketChannel channel,
ByteBuffer buffer,
int length) |
static ByteBuffer |
readCompletely(SocketChannel socketChannel,
ByteBuffer byteBuffer)
This method either read to completely fill the passed
ByteBuffer from position to limit
or it throws an exception to indicate failure. |
static void |
readIntoBuffer(SocketChannel channel,
ByteBuffer buffer,
int responseTimeout) |
static ByteBuffer |
readIntoBufferKnownLength(SocketChannel channel,
ByteBuffer buffer,
int responseTimeout,
int length) |
static void |
write(SocketChannel channel,
ByteBuffer buffer) |
static ByteBuffer |
writeCompletely(SocketChannel socketChannel,
ByteBuffer byteBuffer)
This method either writes all of the passed
ByteBuffer's bytes from position to limit
or it throws an exception to indicate failure. |
static void |
writeFromBuffer(SocketChannel channel,
ByteBuffer buffer,
int responseTimeout) |
public static ByteOrder byteOrder()
public static final ServerSocketChannel openServerSocketChannel(InetSocketAddress address) throws ComException
ComExceptionpublic static final SocketChannel acceptSocketChannel(ServerSocketChannel serverSocketChannel) throws ComException
ComExceptionpublic static SocketChannel openChannel(InetSocketAddress address) throws ComException
ComExceptionpublic static InetAddress localHostAddress() throws ComException
InetAddress.getLocalHost().InetAddress.ComException - if InetAddress.getLocalHost() throws an UnknownHostExceptionpublic static InetSocketAddress localHostSocketAddress() throws ComException
InetSocketAddress instance with localHostAddress() and port 0 (ephemeral port).InetSocketAddress.ComException - if a communication error occursInetSocketAddress(InetAddress, int)public static InetSocketAddress localHostSocketAddress(int port) throws ComException
InetSocketAddress instance with localHostAddress() and the passed port value.port - the port to be used.InetSocketAddress with the passed port value.ComException - if a communication error occursInetSocketAddress(InetAddress, int)public static SocketChannel openChannelLocalhost() throws ComException
ComExceptionpublic static SocketChannel openChannelLocalhost(int port) throws ComException
ComExceptionpublic static final void closeChannel(NetworkChannel channel) throws ComException
ComExceptionpublic static ByteBuffer writeCompletely(SocketChannel socketChannel, ByteBuffer byteBuffer) throws ComException
ByteBuffer's bytes from position to limit
or it throws an exception to indicate failure.socketChannel - the target channelbyteBuffer - the source bufferByteBuffer instance.ComException - if a communication error occurspublic static ByteBuffer readCompletely(SocketChannel socketChannel, ByteBuffer byteBuffer) throws ComException
ByteBuffer from position to limit
or it throws an exception to indicate failure.socketChannel - the source channelbyteBuffer - the target bufferByteBuffer instance.ComException - if a communication error occurspublic static final ByteBuffer readIntoBufferKnownLength(SocketChannel channel, ByteBuffer buffer, int responseTimeout, int length) throws ComException
ComExceptionpublic static int read(SocketChannel channel, ByteBuffer buffer) throws ComException
ComExceptionpublic static ByteBuffer read(SocketChannel channel, ByteBuffer buffer, int length)
public static void write(SocketChannel channel, ByteBuffer buffer) throws ComException
ComExceptionpublic static void readIntoBuffer(SocketChannel channel, ByteBuffer buffer, int responseTimeout) throws ComException, ComExceptionTimeout
ComExceptionComExceptionTimeoutpublic static void writeFromBuffer(SocketChannel channel, ByteBuffer buffer, int responseTimeout) throws ComException, ComExceptionTimeout
ComExceptionComExceptionTimeoutCopyright © 2022 MicroStream Software. All rights reserved.