public interface ConnectionSocket
extends java.io.Closeable
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ConnectionSocket.AsyncFactory
An asynchronous factory of sockets.
|
static interface |
ConnectionSocket.Factory
A factory of sockets.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the connection socket.
|
boolean |
isOpen()
Checks if the connection socket is open.
|
@NotNull java.nio.ByteBuffer |
read(int length)
Reads a defined amount of bytes, and wraps it in a
ByteBuffer. |
@NotNull java.lang.String |
readCString(@Nullable java.lang.Long timeoutMs)
Reads a null-terminated string, under a timeout.
|
void |
write(@NotNull java.nio.ByteBuffer buffer)
Writes the contents of the buffer into the socket.
|
boolean isOpen()
void close()
close in interface java.lang.AutoCloseableclose in interface java.io.Closeablevoid write(@NotNull
@NotNull java.nio.ByteBuffer buffer)
buffer - the contents to write.@NotNull @NotNull java.nio.ByteBuffer read(int length)
ByteBuffer.length - the length of bytes to read.ByteBuffer with the read contents.@NotNull
@NotNull java.lang.String readCString(@Nullable
@Nullable java.lang.Long timeoutMs)
timeoutMs - the timeout, in milliseconds