Skip to content

Commit 7f9f9df

Browse files
authored
Merge pull request TooTallNate#457 from marci4/ja
Fixed javadocs generation warnings
2 parents 543bd90 + 9aaa573 commit 7f9f9df

17 files changed

+318
-74
lines changed

build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<project default="all">
2-
32
<target name="all" depends="doc,jar" />
43

54
<target name="compile">
65
<mkdir dir="build/classes" />
76
<mkdir dir="build/examples" />
87
<javac includeantruntime="false" debug="on" srcdir="src/main/java"
9-
destdir="build/classes" target="1.6" />
8+
destdir="build/classes" target="1.6" source="1.6">
9+
</javac>
1010
<javac includeantruntime="false" srcdir="src/main/example/"
1111
classpath="build/classes" destdir="build/examples" />
1212
</target>

dist/java_websocket.jar

-97.7 KB
Binary file not shown.

src/main/java/org/java_websocket/AbstractWrappedByteChannel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public boolean isNeedRead() {
5959
}
6060

6161
@Override
62-
public int readMore( ByteBuffer dst ) throws SSLException {
62+
public int readMore( ByteBuffer dst ) throws IOException {
6363
return channel instanceof WrappedByteChannel ? ( (WrappedByteChannel) channel ).readMore( dst ) : 0;
6464
}
6565

src/main/java/org/java_websocket/SSLSocketChannel2.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/**
2-
* Copyright (C) 2003 Alexander Kout
3-
* Originally from the jFxp project (http://jfxp.sourceforge.net/).
4-
* Copied with permission June 11, 2012 by Femi Omojola (fomojola@ideasynthesis.com).
1+
/*
2+
Copyright (C) 2003 Alexander Kout
3+
Originally from the jFxp project (http://jfxp.sourceforge.net/).
4+
Copied with permission June 11, 2012 by Femi Omojola (fomojola@ideasynthesis.com).
55
*/
66
package org.java_websocket;
77

src/main/java/org/java_websocket/SocketChannelIOHelper.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ public static boolean read( final ByteBuffer buf, WebSocketImpl ws, ByteChannel
2222

2323
/**
2424
* @see WrappedByteChannel#readMore(ByteBuffer)
25-
* @return returns whether there is more data left which can be obtained via {@link #readMore(ByteBuffer, WebSocketImpl, WrappedByteChannel)}
25+
* @param buf The ByteBuffer to read from
26+
* @param ws The WebSocketImpl associated with the channels
27+
* @param channel The channel to read from
28+
* @return returns Whether there is more data left which can be obtained via {@link WrappedByteChannel#readMore(ByteBuffer)}
29+
* @throws IOException May be thrown by {@link WrappedByteChannel#readMore(ByteBuffer)}#
2630
**/
2731
public static boolean readMore( final ByteBuffer buf, WebSocketImpl ws, WrappedByteChannel channel ) throws IOException {
2832
buf.clear();
@@ -36,7 +40,12 @@ public static boolean readMore( final ByteBuffer buf, WebSocketImpl ws, WrappedB
3640
return channel.isNeedRead();
3741
}
3842

39-
/** Returns whether the whole outQueue has been flushed */
43+
/** Returns whether the whole outQueue has been flushed
44+
* @param ws The WebSocketImpl associated with the channels
45+
* @param sockchannel The channel to write to
46+
* @throws IOException May be thrown by {@link WrappedByteChannel#writeMore()}
47+
* @return returns Whether there is more data to write
48+
*/
4049
public static boolean batch( WebSocketImpl ws, ByteChannel sockchannel ) throws IOException {
4150
ByteBuffer buffer = ws.outQueue.peek();
4251
WrappedByteChannel c = null;

src/main/java/org/java_websocket/WebSocket.java

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@
99
import org.java_websocket.framing.Framedata.Opcode;
1010

1111
public interface WebSocket {
12+
/**
13+
* Enum which represents the states a websocket may be in
14+
*/
1215
public enum Role {
1316
CLIENT, SERVER
1417
}
1518

19+
/**
20+
* Enum which represents the state a websocket may be in
21+
*/
1622
public enum READYSTATE {
1723
NOT_YET_CONNECTED, CONNECTING, OPEN, CLOSING, CLOSED
1824
}
@@ -29,9 +35,16 @@ public enum READYSTATE {
2935
/**
3036
* sends the closing handshake.
3137
* may be send in response to an other handshake.
38+
* @param code the closing code
39+
* @param message the closing message
3240
*/
3341
public void close( int code, String message );
3442

43+
/**
44+
* sends the closing handshake.
45+
* may be send in response to an other handshake.
46+
* @param code the closing code
47+
*/
3548
public void close( int code );
3649

3750
/** Convenience function which behaves like close(CloseFrame.NORMAL) */
@@ -40,26 +53,41 @@ public enum READYSTATE {
4053
/**
4154
* This will close the connection immediately without a proper close handshake.
4255
* The code and the message therefore won't be transfered over the wire also they will be forwarded to onClose/onWebsocketClose.
56+
* @param code the closing code
57+
* @param message the closing message
4358
**/
4459
public abstract void closeConnection( int code, String message );
4560

4661
/**
4762
* Send Text data to the other end.
4863
*
64+
* @param text the text data to send
4965
* @throws NotYetConnectedException websocket is not yet connected
5066
*/
5167
public abstract void send( String text ) throws NotYetConnectedException;
5268

5369
/**
5470
* Send Binary data (plain bytes) to the other end.
55-
*
71+
*
72+
* @param bytes the binary data to send
5673
* @throws IllegalArgumentException the data is null
5774
* @throws NotYetConnectedException websocket is not yet connected
5875
*/
5976
public abstract void send( ByteBuffer bytes ) throws IllegalArgumentException , NotYetConnectedException;
6077

78+
/**
79+
* Send Binary data (plain bytes) to the other end.
80+
*
81+
* @param bytes the byte array to send
82+
* @throws IllegalArgumentException the data is null
83+
* @throws NotYetConnectedException websocket is not yet connected
84+
*/
6185
public abstract void send( byte[] bytes ) throws IllegalArgumentException , NotYetConnectedException;
6286

87+
/**
88+
* Send a frame to the other end
89+
* @param framedata the frame to send to the other end
90+
*/
6391
public abstract void sendFrame( Framedata framedata );
6492

6593
/**
@@ -77,33 +105,61 @@ public enum READYSTATE {
77105
**/
78106
public abstract void sendFragmentedFrame( Opcode op, ByteBuffer buffer, boolean fin );
79107

108+
/**
109+
* Checks if the websocket has buffered data
110+
* @return has the websocket buffered data
111+
*/
80112
public abstract boolean hasBufferedData();
81113

82114
/**
115+
* Returns the address of the endpoint this socket is connected to, or{@code null} if it is unconnected.
116+
*
83117
* @return never returns null
84118
*/
85119
public abstract InetSocketAddress getRemoteSocketAddress();
86120

87121
/**
122+
* Returns the address of the endpoint this socket is bound to.
123+
*
88124
* @return never returns null
89125
*/
90126
public abstract InetSocketAddress getLocalSocketAddress();
91127

128+
/**
129+
* Is the websocket in the state CONNECTING
130+
* @return state equals READYSTATE.CONNECTING
131+
*/
92132
public abstract boolean isConnecting();
93133

134+
/**
135+
* Is the websocket in the state OPEN
136+
* @return state equals READYSTATE.OPEN
137+
*/
94138
public abstract boolean isOpen();
95139

140+
/**
141+
* Is the websocket in the state CLOSING
142+
* @return state equals READYSTATE.CLOSING
143+
*/
96144
public abstract boolean isClosing();
97145

98146
/**
99147
* Returns true when no further frames may be submitted<br>
100148
* This happens before the socket connection is closed.
149+
* @return true when no further frames may be submitted
101150
*/
102151
public abstract boolean isFlushAndClose();
103152

104-
/** Returns whether the close handshake has been completed and the socket is closed. */
153+
/**
154+
* Is the websocket in the state CLOSED
155+
* @return state equals READYSTATE.CLOSED
156+
*/
105157
public abstract boolean isClosed();
106158

159+
/**
160+
* Getter for the draft
161+
* @return the used draft
162+
*/
107163
public abstract Draft getDraft();
108164

109165
/**
@@ -118,6 +174,7 @@ public enum READYSTATE {
118174
/**
119175
* Returns the HTTP Request-URI as defined by http://tools.ietf.org/html/rfc2616#section-5.1.2<br>
120176
* If the opening handshake has not yet happened it will return null.
177+
* @return Returns the decoded path component of this URI.
121178
**/
122179
public abstract String getResourceDescriptor();
123180
}

src/main/java/org/java_websocket/WebSocketAdapter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public abstract class WebSocketAdapter implements WebSocketListener {
2020

2121
/**
2222
* This default implementation does not do anything. Go ahead and overwrite it.
23-
*
23+
*
2424
* @see org.java_websocket.WebSocketListener#onWebsocketHandshakeReceivedAsServer(WebSocket, Draft, ClientHandshake)
2525
*/
2626
@Override
@@ -34,7 +34,7 @@ public void onWebsocketHandshakeReceivedAsClient( WebSocket conn, ClientHandshak
3434

3535
/**
3636
* This default implementation does not do anything which will cause the connections to always progress.
37-
*
37+
*
3838
* @see org.java_websocket.WebSocketListener#onWebsocketHandshakeSentAsClient(WebSocket, ClientHandshake)
3939
*/
4040
@Override
@@ -43,7 +43,7 @@ public void onWebsocketHandshakeSentAsClient( WebSocket conn, ClientHandshake re
4343

4444
/**
4545
* This default implementation does not do anything. Go ahead and overwrite it
46-
*
46+
*
4747
* @see org.java_websocket.WebSocketListener#onWebsocketMessageFragment(WebSocket, Framedata)
4848
*/
4949
@Override
@@ -53,7 +53,7 @@ public void onWebsocketMessageFragment( WebSocket conn, Framedata frame ) {
5353
/**
5454
* This default implementation will send a pong in response to the received ping.
5555
* The pong frame will have the same payload as the ping frame.
56-
*
56+
*
5757
* @see org.java_websocket.WebSocketListener#onWebsocketPing(WebSocket, Framedata)
5858
*/
5959
@Override
@@ -65,7 +65,7 @@ public void onWebsocketPing( WebSocket conn, Framedata f ) {
6565

6666
/**
6767
* This default implementation does not do anything. Go ahead and overwrite it.
68-
*
68+
*
6969
* @see org.java_websocket.WebSocketListener#onWebsocketPong(WebSocket, Framedata)
7070
*/
7171
@Override

src/main/java/org/java_websocket/WebSocketImpl.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ public class WebSocketImpl implements WebSocket {
9797
private String resourceDescriptor = null;
9898

9999
/**
100-
* creates a websocket with server role
100+
* Creates a websocket with server role
101+
*
102+
* @param listener The listener for this instance
103+
* @param drafts The drafts which should be used
101104
*/
102105
public WebSocketImpl( WebSocketListener listener, List<Draft> drafts ) {
103106
this( listener, ( Draft ) null );
@@ -113,7 +116,8 @@ public WebSocketImpl( WebSocketListener listener, List<Draft> drafts ) {
113116
/**
114117
* creates a websocket with client role
115118
*
116-
* @param listener may be unbound
119+
* @param listener The listener for this instance
120+
* @param draft The draft which should be used
117121
*/
118122
public WebSocketImpl( WebSocketListener listener, Draft draft ) {
119123
if( listener == null || ( draft == null && role == Role.SERVER ) )// socket can be null because we want do be able to create the object without already having a bound channel
@@ -137,7 +141,8 @@ public WebSocketImpl( WebSocketListener listener, List<Draft> drafts, Socket soc
137141
}
138142

139143
/**
140-
*
144+
* Method to decode the provided ByteBuffer
145+
* @param socketBuffer the ByteBuffer to decode
141146
*/
142147
public void decode( ByteBuffer socketBuffer ) {
143148
assert ( socketBuffer.hasRemaining() );
@@ -458,12 +463,15 @@ public void close( int code, String message ) {
458463
}
459464

460465
/**
466+
* This will close the connection immediately without a proper close handshake.
467+
* The code and the message therefore won't be transfered over the wire also they will be forwarded to onClose/onWebsocketClose.
468+
* @param code the closing code
469+
* @param message the closing message
461470
* @param remote Indicates who "generated" <code>code</code>.<br>
462471
* <code>true</code> means that this endpoint received the <code>code</code> from the other endpoint.<br>
463472
* false means this endpoint decided to send the given code,<br>
464473
* <code>remote</code> may also be true if this endpoint started the closing handshake since the other endpoint may not simply echo the <code>code</code> but close the connection the same time this endpoint does do but with an other <code>code</code>. <br>
465474
**/
466-
467475
protected synchronized void closeConnection( int code, String message, boolean remote ) {
468476
if( readystate == READYSTATE.CLOSED ) {
469477
return;

0 commit comments

Comments
 (0)