@@ -31,6 +31,7 @@ public class CircularByteBuffer {
3131
3232 /**
3333 * Creates a new instance with the given buffer size.
34+ * @param pSize the size of buffer to create
3435 */
3536 public CircularByteBuffer (int pSize ) {
3637 buffer = new byte [pSize ];
@@ -128,9 +129,12 @@ public void add(byte pByte) {
128129 * {@code pBuffer}, {@code pOffset}, and {@code pLength}. No bytes are being
129130 * removed from the buffer. If the result is true, then the following invocations
130131 * of {@link #read()} are guaranteed to return exactly those bytes.
132+ * @param pBuffer the buffer to compare against
133+ * @param pOffset start offset
134+ * @param pLength length to compare
131135 * @return True, if the next invocations of {@link #read()} will return the
132136 * bytes at offsets {@code pOffset}+0, {@code pOffset}+1, ...,
133- * @code{ pOffset}+@code{ pLength}-1 of byte array {@code pBuffer}.
137+ * { @code pOffset}+{ @code pLength}-1 of byte array {@code pBuffer}.
134138 * @throws IllegalArgumentException Either of {@code pOffset}, or {@code pLength} is negative.
135139 * @throws NullPointerException The byte array {@code pBuffer} is null.
136140 */
@@ -160,7 +164,10 @@ public boolean peek(byte[] pBuffer, int pOffset, int pLength) {
160164 /**
161165 * Adds the given bytes to the buffer. This is the same as invoking {@link #add(byte)}
162166 * for the bytes at offsets {@code pOffset}+0, {@code pOffset}+1, ...,
163- * @code{pOffset}+@code{pLength}-1 of byte array {@code pBuffer}.
167+ * {@code pOffset}+{@code pLength}-1 of byte array {@code pBuffer}.
168+ * @param pBuffer the buffer to copy
169+ * @param pOffset start offset
170+ * @param pLength length to copy
164171 * @throws IllegalStateException The buffer doesn't have sufficient space. Use
165172 * {@link #getSpace()} to prevent this exception.
166173 * @throws IllegalArgumentException Either of {@code pOffset}, or {@code pLength} is negative.
@@ -191,6 +198,7 @@ public void add(byte[] pBuffer, int pOffset, int pLength) {
191198 * Same as {@link #hasSpace(int) hasSpace(1)}.
192199 * @see #hasSpace(int)
193200 * @see #getSpace()
201+ * @return true if there is space for a byte
194202 */
195203 public boolean hasSpace () {
196204 return currentNumberOfBytes < buffer .length ;
@@ -200,27 +208,32 @@ public boolean hasSpace() {
200208 * Returns, whether there is currently room for the given number of bytes in the buffer.
201209 * @see #hasSpace()
202210 * @see #getSpace()
211+ * @param pBytes the byte count
212+ * @return true if there is space for the given number of bytes
203213 */
204214 public boolean hasSpace (int pBytes ) {
205215 return currentNumberOfBytes +pBytes <= buffer .length ;
206216 }
207217
208218 /**
209219 * Returns, whether the buffer is currently holding, at least, a single byte.
220+ * @return true if the buffer is not empty
210221 */
211222 public boolean hasBytes () {
212223 return currentNumberOfBytes > 0 ;
213224 }
214225
215226 /**
216227 * Returns the number of bytes, that can currently be added to the buffer.
228+ * @return the number of bytes that can be added
217229 */
218230 public int getSpace () {
219231 return buffer .length - currentNumberOfBytes ;
220232 }
221233
222234 /**
223235 * Returns the number of bytes, that are currently present in the buffer.
236+ * @return the number of bytes
224237 */
225238 public int getCurrentNumberOfBytes () {
226239 return currentNumberOfBytes ;
0 commit comments