Skip to content

Commit

Permalink
Clean-up. Add missing Javadoc tags
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Thomas <markt@apache.org>
  • Loading branch information
markt-asf committed Sep 18, 2018
1 parent 50252c2 commit 115a21d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
20 changes: 19 additions & 1 deletion api/client/src/main/java/javax/websocket/Decoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface Decoder {
/**
* This method is called with the endpoint configuration object of the endpoint this decoder is intended for when it
* is about to be brought into service.
*
*
* @param config the endpoint configuration object when being brought into service
*/
void init(EndpointConfig config);
Expand All @@ -49,6 +49,8 @@ public interface Decoder {
/**
* This interface defines how a custom object (of type T) is decoded from a web socket message in the form of a byte
* buffer.
*
* @param <T> The type of the object that is decoded
*/
interface Binary<T> extends Decoder {

Expand All @@ -57,6 +59,8 @@ interface Binary<T> extends Decoder {
*
* @param bytes the bytes to be decoded.
* @return the decoded object.
*
* @throws DecodeException If the provided bytes cannot be decoded to type T
*/
T decode(ByteBuffer bytes) throws DecodeException;

Expand All @@ -72,6 +76,8 @@ interface Binary<T> extends Decoder {

/**
* This interface defines how a custom object is decoded from a web socket message in the form of a binary stream.
*
* @param <T> The type of the object that is decoded
*/
interface BinaryStream<T> extends Decoder {

Expand All @@ -80,20 +86,27 @@ interface BinaryStream<T> extends Decoder {
*
* @param is the input stream carrying the bytes.
* @return the decoded object.
*
* @throws DecodeException If the provided input stream cannot be decoded to type T
* @throws IOException If an error occurs reading the input stream
*/
T decode(InputStream is) throws DecodeException, IOException;

}

/**
* This interface defines how a custom object is decoded from a web socket message in the form of a string.
*
* @param <T> The type of the object that is decoded
*/
interface Text<T> extends Decoder {
/**
* Decode the given String into an object of type T.
*
* @param s string to be decoded.
* @return the decoded message as an object of type T
*
* @throws DecodeException If the provided string cannot be decoded to type T
*/
T decode(String s) throws DecodeException;

Expand All @@ -110,6 +123,8 @@ interface Text<T> extends Decoder {
/**
* This interface defines how a custom object of type T is decoded from a web socket message in the form of a
* character stream.
*
* @param <T> The type of the object that is decoded
*/
interface TextStream<T> extends Decoder {
/**
Expand All @@ -118,6 +133,9 @@ interface TextStream<T> extends Decoder {
*
* @param reader the reader from which to read the web socket message.
* @return the instance of the object that is the decoded web socket message.
*
* @throws DecodeException If the data from the provided reader cannot be decoded to type T
* @throws IOException If an error occurs reading from the reader
*/
T decode(Reader reader) throws DecodeException, IOException;

Expand Down
9 changes: 8 additions & 1 deletion api/client/src/main/java/javax/websocket/Encoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface Encoder {
/**
* This method is called with the endpoint configuration object of the endpoint this encoder is intended for when it
* is about to be brought into service.
*
*
* @param config the endpoint configuration object when being brought into service
*/
void init(EndpointConfig config);
Expand All @@ -58,6 +58,8 @@ interface Text<T> extends Encoder {
*
* @param object the object being encoded.
* @return the encoded object as a string.
*
* @throws EncodeException The provided object could not be encoded as a string
*/
String encode(T object) throws EncodeException;

Expand Down Expand Up @@ -94,6 +96,8 @@ interface Binary<T> extends Encoder {
*
* @param object the object being encoded.
* @return the binary data.
*
* @throws EncodeException The provided object could not be encoded to a byte buffer
*/
ByteBuffer encode(T object) throws EncodeException;
}
Expand All @@ -110,6 +114,9 @@ interface BinaryStream<T> extends Encoder {
*
* @param object the object being encoded.
* @param os the output stream where the encoded data is written.
*
* @throws EncodeException The provided object could not be encoded to an output stream
* @throws IOException If an error occurred writing to the output stream
*/
void encode(T object, OutputStream os) throws EncodeException, IOException;
}
Expand Down
5 changes: 5 additions & 0 deletions api/client/src/main/java/javax/websocket/RemoteEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,17 @@ public interface RemoteEndpoint {
* Return whether the implementation is allowed to batch outgoing messages before sending. The default mode for
* RemoteEndpoints is false. The value may be changed by calling {@link #setBatchingAllowed(boolean)
* setBatchingAllowed}.
*
* @return {@code true} if the implementation is allowed to batch outgoing messages before sending, otherwise
* {@code false}
*/
boolean getBatchingAllowed();

/**
* This method is only used when batching is allowed for this RemoteEndpint. Calling this method forces the
* implementation to send any unsent messages it has been batching.
*
* @throws IOException if the sending of any unsent messages failed
*/
void flushBatch() throws IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public interface WebSocketContainer {
* RemoteEndpoints associated with this container. A non-positive number indicates the implementation will not
* timeout attempting to send a websocket message asynchronously. Note this default may be overridden in each
* RemoteEndpoint.
*
* @param timeoutmillis the timeout in milliseconds or a non-positive number for no timeout
*/
void setAsyncSendTimeout(long timeoutmillis);

Expand Down

0 comments on commit 115a21d

Please sign in to comment.