Skip to content

Commit

Permalink
Better Java Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Konloch committed Dec 15, 2023
1 parent 06c2f9f commit f206eb6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 37 deletions.
17 changes: 0 additions & 17 deletions src/main/java/com/konloch/vortex/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class Client

/**
* Construct a new socket client
*
* @param server the socket server this client will be bound to
* @param socket the socket channel this client is using for communication
* @param uid the unique user identifier this socket client is assigned
Expand All @@ -44,7 +43,6 @@ public Client(Server server, SocketChannel socket, long uid)

/**
* Write to a byte array the output buffer
*
* @param bytes any byte array
*/
public void write(byte[] bytes)
Expand All @@ -63,7 +61,6 @@ public void write(byte[] bytes)

/**
* Returns the output buffer write progress
*
* @return the output buffer write progress
*/
public int getOutputBufferProgress()
Expand All @@ -73,7 +70,6 @@ public int getOutputBufferProgress()

/**
* Adds to the output buffer progress and then returns the current value
*
* @param add the amount of progress to increase by
* @return the output buffer write progress
*/
Expand Down Expand Up @@ -111,7 +107,6 @@ protected void resetLastNetworkActivityWrite()

/**
* Returns the unique user id for this specific connection
*
* @return the unique user id for this specific connection
*/
public long getUID()
Expand All @@ -130,7 +125,6 @@ public String getRemoteAddress()

/**
* Returns the last read network activity for this socket
*
* @return a long representing the timestamp of the last time the socket read
*/
public long getLastNetworkActivityRead()
Expand All @@ -140,7 +134,6 @@ public long getLastNetworkActivityRead()

/**
* Returns the last write network activity for this socket
*
* @return a long representing the timestamp of the last time the socket writes
*/
public long getLastNetworkActivityWrite()
Expand All @@ -150,7 +143,6 @@ public long getLastNetworkActivityWrite()

/**
* Returns true if the socket client is in the read state
*
* @return true if the socket client is in the read state
*/
public boolean isInputRead()
Expand All @@ -160,7 +152,6 @@ public boolean isInputRead()

/**
* Set the read state for the socket client
*
* @param inputRead set true to enable the read state for the socket client
*/
public void setInputRead(boolean inputRead)
Expand All @@ -170,7 +161,6 @@ public void setInputRead(boolean inputRead)

/**
* Returns true if the socket client is in the write state
*
* @return true if the socket client is in the write state
*/
public boolean isOutputWrite()
Expand All @@ -180,7 +170,6 @@ public boolean isOutputWrite()

/**
* Set the write state for the socket client
*
* @param outputWrite set true to enable the write state for the socket client
*/
public void setOutputWrite(boolean outputWrite)
Expand Down Expand Up @@ -208,7 +197,6 @@ public void setState(int state)

/**
* Returns the input buffer
*
* @return the ByteArrayOutputStream representing the input buffer
*/
public ByteArrayOutputStream getInputBuffer()
Expand All @@ -218,7 +206,6 @@ public ByteArrayOutputStream getInputBuffer()

/**
* Returns the output buffer
*
* @return the ByteArrayOutputStream representing the output buffer
*/
public ByteArrayOutputStream getOutputBuffer()
Expand All @@ -237,7 +224,6 @@ public byte[] getOutputBufferCache()

/**
* Set the output buffer cache
*
* @param outputBufferCache any byte array as the buffer cache
*/
public void setOutputBufferCache(byte[] outputBufferCache)
Expand All @@ -248,7 +234,6 @@ public void setOutputBufferCache(byte[] outputBufferCache)

/**
* Returns the bound NIO socket channel
*
* @return the bound NIO socket channel
*/
public SocketChannel getSocket()
Expand All @@ -258,7 +243,6 @@ public SocketChannel getSocket()

/**
* Returns the socket server this client is bound to
*
* @return the socket server this client is bound to
*/
public Server getServer()
Expand All @@ -268,7 +252,6 @@ public Server getServer()

/**
* Resolve the remote address
*
* @return the remote address, or an empty string if that failed
*/
private String resolveRemoteAddress()
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/konloch/vortex/IO.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class IO implements Runnable

/**
* Construct a new SocketServerIO
*
* @param server the SocketServer this IO Handler is bound to
*/
public IO(Server server)
Expand Down Expand Up @@ -184,7 +183,6 @@ public void run()

/**
* Return the socket client list containing the connected clients
*
* @return the Socket Client list containing the connected clients
*/
public List<Client> getClients()
Expand Down
18 changes: 0 additions & 18 deletions src/main/java/com/konloch/vortex/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class Server extends Thread

/**
* Construct a new Socket Server
*
* @param port any port between 0-65,535
* @param requestHandler the request handler
* @throws IOException thrown if any IO issues are encountered.
Expand All @@ -43,7 +42,6 @@ public Server(int port, ClientRunnable requestHandler) throws IOException

/**
* Construct a new Socket Server
*
* @param port any port between 0-65,535
* @param threadPool the amount of threads that will be started
* @param networkConnectionFilter the pre-requst filter
Expand All @@ -58,7 +56,6 @@ public Server(int port, int threadPool, IsAllowed networkConnectionFilter,

/**
* Construct a new Socket Server
*
* @param hostname the hostname the socket will bind to
* @param port any port between 0-65,535
* @param threadPool the amount of threads that will be started
Expand All @@ -79,7 +76,6 @@ public Server(String hostname, int port, int threadPool, IsAllowed networkConnec

/**
* Bind to the socket port
*
* @return this instance for method chaining
* @throws IOException thrown if any IO issues are encountered.
*/
Expand Down Expand Up @@ -154,7 +150,6 @@ public void run()

/**
* Attempts to accept an incoming socket connection, if there is not one in the queue it will return false.
*
* @return true if a connection has been accepted
* @throws IOException thrown if any IO issues are encountered.
*/
Expand Down Expand Up @@ -203,7 +198,6 @@ public boolean acceptConnection() throws IOException

/**
* Returns the port the socket server is bound to
*
* @return the port the socket server is bound to
*/
public int getPort()
Expand All @@ -213,7 +207,6 @@ public int getPort()

/**
* Returns true if the socket server is still running
*
* @return true if the socket server is still running
*/
public boolean isRunning()
Expand All @@ -223,7 +216,6 @@ public boolean isRunning()

/**
* Stops the socket server
*
* @return this instance for method chaining
*/
public Server stopSocketServer()
Expand All @@ -234,7 +226,6 @@ public Server stopSocketServer()

/**
* Returns true if the socket server has been stopped
*
* @return true if the socket server has been stopped
*/
public boolean hasStopped()
Expand All @@ -244,7 +235,6 @@ public boolean hasStopped()

/**
* Returns the request handler
*
* @return the request handler
*/
public ClientRunnable getRequestHandler()
Expand All @@ -254,7 +244,6 @@ public ClientRunnable getRequestHandler()

/**
* Set the request handler
*
* @param requestHandler any request handler
* @return this instance for method chaining
*/
Expand All @@ -266,7 +255,6 @@ public Server setRequestHandler(ClientRunnable requestHandler)

/**
* Returns the onDisconnect handler
*
* @return the onDisconnect handler
*/
public ClientRunnable getOnDisconnect()
Expand All @@ -276,7 +264,6 @@ public ClientRunnable getOnDisconnect()

/**
* Set the onDisconnect handler
*
* @param onDisconnect any onDisconnet handler
* @return this instance for method chaining
*/
Expand All @@ -288,7 +275,6 @@ public Server setOnDisconnect(ClientRunnable onDisconnect)

/**
* Returns the network connection filter
*
* @return the network connection filter
*/
public IsAllowed getNetworkConnectionFilter()
Expand Down Expand Up @@ -328,7 +314,6 @@ public int getTimeout()

/**
* Set the timeout value for network activity
*
* @param timeout any integer representing the milliseconds for timeout from network activity
* @return this instance for method chaining
*/
Expand All @@ -340,7 +325,6 @@ public Server setTimeout(int timeout)

/**
* Return the default size of the byte buffers
*
* @return default size of the byte buffers
*/
public int getIOAmount()
Expand All @@ -350,7 +334,6 @@ public int getIOAmount()

/**
* Set the default size of the byte buffers
*
* @param ioAmount any integer as the default size of the byte buffers
* @return this instance for method chaining
*/
Expand All @@ -363,7 +346,6 @@ public Server setIOAmount(int ioAmount)

/**
* Alert that this is a library
*
* @param args program launch arguments
*/
public static void main(String[] args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@
*/
public interface ClientRunnable
{
/**
* Runnable function
* @param client the client reference
*/
void run(Client client);
}
5 changes: 5 additions & 0 deletions src/main/java/com/konloch/vortex/interfaces/IsAllowed.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
*/
public interface IsAllowed
{
/**
* Used for filtering
* @param client the client reference
* @return true if allowed, false if not
*/
boolean allowed(Client client);
}

0 comments on commit f206eb6

Please sign in to comment.