Improves some documentation.

I was starting to get confused.
This commit is contained in:
Markil3
2022-01-22 08:00:27 -07:00
parent d2473d3873
commit ad568b2ec2
16 changed files with 377 additions and 59 deletions

View File

@@ -1,5 +1,9 @@
/*
* Copyright (c) 2021 William Hubbard. All Rights Reserved.
*
* This module contains a series of classes used by multiple modules (notably, the :browser and :interface modules).
* Notably, it contains commands that the browser reacts to, the response structure, and data structures that is
* frequently passed to and from the interface and browser.
*/
plugins {
@@ -24,6 +28,8 @@ dependencies {
implementation 'net.harawata:appdirs:1.2.1'
implementation 'net.harawata:appdirs:1.2.1'
// Declare the dependency for your favourite test framework you want to use in your tests.
// TestNG is also supported by the Gradle Test task. Just change the
// testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add

View File

@@ -14,7 +14,7 @@ import java.util.Arrays;
public interface MessageSerializer
{
Logger getLogger();
/**
* Converts an object into a form that can be sent.
*
@@ -33,7 +33,7 @@ public interface MessageSerializer
return byteStream.toByteArray();
}
}
/**
* Converts a byte stream into an object.
*
@@ -57,15 +57,20 @@ public interface MessageSerializer
}
}
}
/**
* Writes a message to the output stream.
* <p>
* By default, it will first write the number of the message (one integer
* of 4 bytes), and then the length of the message in bytes (another
* integer of four bytes). It finally writes the data stream before
* flushing the stream.
*
* @param out - The output stream to write to.
* @param messageNum - The ID of the message being sent. This will help keep
* track of responses.
* @param message - The actual message contents to write.
* @throws IOException Thrown when an exception occures
* @throws IOException Thrown when an exception occurs
*/
default void writeMessage(OutputStream out, int messageNum, byte[] message) throws IOException
{
@@ -94,9 +99,9 @@ public interface MessageSerializer
out.write(message);
out.flush();
}
/**
* Reads a message from the input stream
* Reads a message from the input stream.
*
* @param in - The input stream to read from.
* @return Two byte arrays, each with their own value encoded. The first is
@@ -153,7 +158,7 @@ public interface MessageSerializer
getLogger().trace("Reading message");
return new byte[][]{messageNum, message};
}
/**
* This method is called when an error in deserialization occurs.
*