public class Connector<T extends Client<Connection<T>>>
extends java.lang.Object
| Constructor and Description |
|---|
Connector() |
| Modifier and Type | Method and Description |
|---|---|
Connector<T> |
bufferDefaultSize(int bufferSize)
Sets the size limit of the data buffer sent/received.
|
Connector<T> |
bufferLargePoolSize(int bufferPoolSize)
Sets the maximum amount of buffer with large size that can be holder on the BufferPool.
|
Connector<T> |
bufferLargeSize(int bufferSize)
Sets the large size of the data buffer sent/received.
|
Connector<T> |
bufferMediumPoolSize(int bufferPoolSize)
Sets the maximum amount of buffer with medium size that can be holder on the BufferPool.
|
Connector<T> |
bufferMediumSize(int bufferSize)
Sets the medium size of the data buffer sent/received.
|
Connector<T> |
bufferPoolSize(int bufferPoolSize)
Sets the maximum amount of buffer with default size that can be holder on the BufferPool.
|
Connector<T> |
bufferSmallPoolSize(int bufferPoolSize)
Sets the maximum amount of buffer with small size that can be holder on the BufferPool.
|
Connector<T> |
bufferSmallSize(int bufferSize)
Sets the small size of the data buffer sent/received.
|
Connector<T> |
byteOrder(java.nio.ByteOrder order)
Sets the byte order used to send and receive packets.
|
T |
connect(java.net.InetSocketAddress socketAddress)
Connects to a host with socketAddress
|
T |
connect(java.lang.String host,
int port)
Connects to a host using the address and port.
|
static <T extends Client<Connection<T>>> |
create(ClientFactory<T> clientFactory,
PacketHandler<T> packetHandler,
PacketExecutor<T> executor)
Creates a Connector holding the minimum requirements to create a Client.
|
public static <T extends Client<Connection<T>>> Connector<T> create(ClientFactory<T> clientFactory, PacketHandler<T> packetHandler, PacketExecutor<T> executor)
T - - The Type of client that ConnectionBuilder will handle.clientFactory - - The factory responsible to create a new Client when a new connection is accepted.packetHandler - - The handle responsible to convert the data received into a ReadablePacketexecutor - - The responsible to execute the incoming packets.public Connector<T> bufferDefaultSize(int bufferSize)
bufferSize - - the buffer size to be setpublic Connector<T> bufferSmallSize(int bufferSize)
bufferSize - - the buffer size to be setpublic Connector<T> bufferMediumSize(int bufferSize)
bufferSize - - the buffer size to be setpublic Connector<T> bufferLargeSize(int bufferSize)
bufferSize - - the buffer size to be setpublic Connector<T> bufferPoolSize(int bufferPoolSize)
bufferPoolSize - - the size of the buffer pool size.public Connector<T> bufferSmallPoolSize(int bufferPoolSize)
bufferPoolSize - - the size of the buffer pool size.public Connector<T> bufferMediumPoolSize(int bufferPoolSize)
bufferPoolSize - - the size of the buffer pool size.public Connector<T> bufferLargePoolSize(int bufferPoolSize)
bufferPoolSize - - the size of the buffer pool size.public Connector<T> byteOrder(java.nio.ByteOrder order)
ByteOrder.LITTLE_ENDIANorder - - the order to be used.public T connect(java.lang.String host, int port) throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
host - the address to be connected toport - the port of the hostjava.io.IOException - if a IO error happens during the connection.java.util.concurrent.ExecutionException - if the computation threw an exceptionjava.lang.InterruptedException - if the current thread was interrupted while waitingpublic T connect(java.net.InetSocketAddress socketAddress) throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
socketAddress - the address which will be connectedjava.io.IOException - if a IO error happens during the connection.java.util.concurrent.ExecutionException - if the computation threw an exceptionjava.lang.InterruptedException - if the current thread was interrupted while waiting