public class SocketUtil
extends java.lang.Object
| Constructor and Description |
|---|
SocketUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
read(Socket socket,
io.netty.buffer.ByteBuf buffer)
Reads from the socket exactly the number of writable bytes
ByteBuf.writableBytes() of the buffer into the buffer synchronously. |
static void |
read(Socket socket,
io.netty.buffer.ByteBuf buffer,
int bytes)
Reads exactly
bytes bytes of data from the socket synchronously. |
static Future<java.lang.Long> |
readAsync(Socket socket,
io.netty.buffer.ByteBuf buffer)
Reads from the socket exactly the number of writable bytes
ByteBuf.writableBytes() of the buffer into the buffer asynchronously. |
static Future<java.lang.Long> |
readAsync(Socket socket,
io.netty.buffer.ByteBuf buffer,
int bytes)
Reads exactly
bytes bytes of data from the socket asynchronously
and returns a Future with the result of the task. |
public static void read(@NotNull
Socket socket,
@NotNull
io.netty.buffer.ByteBuf buffer,
int bytes)
throws java.lang.Throwable
bytes bytes of data from the socket synchronously.socket - Socket to read frombuffer - Buffer to write the databytes - Number of bytes to readjava.lang.Throwable - If the operation failspublic static void read(@NotNull
Socket socket,
@NotNull
io.netty.buffer.ByteBuf buffer)
throws java.lang.Throwable
ByteBuf.writableBytes() of the buffer into the buffer synchronously.socket - Socket to read frombuffer - Buffer to write the datajava.lang.Throwable - If the operation fails@NotNull public static Future<java.lang.Long> readAsync(@NotNull Socket socket, @NotNull io.netty.buffer.ByteBuf buffer, int bytes)
bytes bytes of data from the socket asynchronously
and returns a Future with the result of the task. If there's an error,
everything that could read is kept inside the buffer.socket - Socket to read frombuffer - Buffer to write the databytes - Number of bytes to readFuturepublic static Future<java.lang.Long> readAsync(@NotNull Socket socket, @NotNull io.netty.buffer.ByteBuf buffer)
ByteBuf.writableBytes() of the buffer into the buffer asynchronously.
If there's an error, everything that could read is kept inside the buffer.socket - Socket to read frombuffer - Buffer to write the dataFuture