You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/05/30 13:54:18 UTC
(commons-compress) 03/04: Javadoc
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit e56aa4fb7435a7db730bd7a4ee37fb4db5a77afa
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Fri May 30 09:02:46 2025 -0400
Javadoc
---
.../commons/compress/utils/ArchiveUtils.java | 116 ++++++++++-----------
1 file changed, 58 insertions(+), 58 deletions(-)
diff --git a/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java b/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java
index 1080bc518..88e2ff5e9 100644
--- a/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java
+++ b/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.java
@@ -33,11 +33,11 @@ public class ArchiveUtils {
private static final int MAX_SANITIZED_NAME_LENGTH = 255;
/**
- * Returns true if the first N bytes of an array are all zero
+ * Returns true if the first N bytes of an array are all zero.
*
- * @param a The array to check
- * @param size The number of characters to check (not the size of the array)
- * @return true if the first N bytes are zero
+ * @param a The array to check.
+ * @param size The number of characters to check (not the size of the array).
+ * @return true if the first N bytes are zero.
*/
public static boolean isArrayZero(final byte[] a, final int size) {
for (int i = 0; i < size; i++) {
@@ -49,11 +49,11 @@ public static boolean isArrayZero(final byte[] a, final int size) {
}
/**
- * Compare byte buffers
+ * Compare byte buffers.
*
- * @param buffer1 the first buffer
- * @param buffer2 the second buffer
- * @return {@code true} if buffer1 and buffer2 have same contents
+ * @param buffer1 the first buffer.
+ * @param buffer2 the second buffer.
+ * @return {@code true} if buffer1 and buffer2 have same contents.
* @deprecated Use {@link Arrays#equals(byte[], byte[])}.
*/
@Deprecated
@@ -62,43 +62,43 @@ public static boolean isEqual(final byte[] buffer1, final byte[] buffer2) {
}
/**
- * Compare byte buffers, optionally ignoring trailing nulls
+ * Compare byte buffers, optionally ignoring trailing nulls.
*
- * @param buffer1 the first buffer
- * @param buffer2 the second buffer
- * @param ignoreTrailingNulls whether to ignore trailing nulls
- * @return {@code true} if buffer1 and buffer2 have same contents
+ * @param buffer1 the first buffer.
+ * @param buffer2 the second buffer.
+ * @param ignoreTrailingNulls whether to ignore trailing nulls.
+ * @return {@code true} if buffer1 and buffer2 have same contents.
*/
public static boolean isEqual(final byte[] buffer1, final byte[] buffer2, final boolean ignoreTrailingNulls) {
return isEqual(buffer1, 0, buffer1.length, buffer2, 0, buffer2.length, ignoreTrailingNulls);
}
/**
- * Compare byte buffers
+ * Compare byte buffers.
*
- * @param buffer1 the first buffer
- * @param offset1 the first offset
- * @param length1 the first length
- * @param buffer2 the second buffer
- * @param offset2 the second offset
- * @param length2 the second length
- * @return {@code true} if buffer1 and buffer2 have same contents
+ * @param buffer1 the first buffer.
+ * @param offset1 the first offset.
+ * @param length1 the first length.
+ * @param buffer2 the second buffer.
+ * @param offset2 the second offset.
+ * @param length2 the second length.
+ * @return {@code true} if buffer1 and buffer2 have same contents.
*/
public static boolean isEqual(final byte[] buffer1, final int offset1, final int length1, final byte[] buffer2, final int offset2, final int length2) {
return isEqual(buffer1, offset1, length1, buffer2, offset2, length2, false);
}
/**
- * Compare byte buffers, optionally ignoring trailing nulls
+ * Compare byte buffers, optionally ignoring trailing nulls.
*
- * @param buffer1 first buffer
- * @param offset1 first offset
- * @param length1 first length
- * @param buffer2 second buffer
- * @param offset2 second offset
- * @param length2 second length
- * @param ignoreTrailingNulls whether to ignore trailing nulls
- * @return {@code true} if buffer1 and buffer2 have same contents, having regard to trailing nulls
+ * @param buffer1 first buffer.
+ * @param offset1 first offset.
+ * @param length1 first length.
+ * @param buffer2 second buffer.
+ * @param offset2 second offset.
+ * @param length2 second length.
+ * @param ignoreTrailingNulls whether to ignore trailing nulls.
+ * @return {@code true} if buffer1 and buffer2 have same contents, having regard to trailing nulls.
*/
public static boolean isEqual(final byte[] buffer1, final int offset1, final int length1, final byte[] buffer2, final int offset2, final int length2,
final boolean ignoreTrailingNulls) {
@@ -131,15 +131,15 @@ public static boolean isEqual(final byte[] buffer1, final int offset1, final int
}
/**
- * Compare byte buffers, ignoring trailing nulls
+ * Compare byte buffers, ignoring trailing nulls.
*
- * @param buffer1 the first buffer
- * @param offset1 the first offset
- * @param length1 the first length
- * @param buffer2 the second buffer
- * @param offset2 the second offset
- * @param length2 the second length
- * @return {@code true} if buffer1 and buffer2 have same contents, having regard to trailing nulls
+ * @param buffer1 the first buffer.
+ * @param offset1 the first offset.
+ * @param length1 the first length.
+ * @param buffer2 the second buffer.
+ * @param offset2 the second offset.
+ * @param length2 the second length.
+ * @return {@code true} if buffer1 and buffer2 have same contents, having regard to trailing nulls.
*/
public static boolean isEqualWithNull(final byte[] buffer1, final int offset1, final int length1, final byte[] buffer2, final int offset2,
final int length2) {
@@ -149,9 +149,9 @@ public static boolean isEqualWithNull(final byte[] buffer1, final int offset1, f
/**
* Check if buffer contents matches ASCII String.
*
- * @param expected the expected string
- * @param buffer the buffer
- * @return {@code true} if buffer is the same as the expected string
+ * @param expected the expected string.
+ * @param buffer the buffer.
+ * @return {@code true} if buffer is the same as the expected string.
*/
public static boolean matchAsciiBuffer(final String expected, final byte[] buffer) {
return matchAsciiBuffer(expected, buffer, 0, buffer.length);
@@ -160,11 +160,11 @@ public static boolean matchAsciiBuffer(final String expected, final byte[] buffe
/**
* Check if buffer contents matches ASCII String.
*
- * @param expected expected string
- * @param buffer the buffer
- * @param offset offset to read from
- * @param length length of the buffer
- * @return {@code true} if buffer is the same as the expected string
+ * @param expected expected string.
+ * @param buffer the buffer.
+ * @param offset offset to read from.
+ * @param length length of the buffer.
+ * @return {@code true} if buffer is the same as the expected string.
*/
public static boolean matchAsciiBuffer(final String expected, final byte[] buffer, final int offset, final int length) {
final byte[] buffer1 = expected.getBytes(US_ASCII);
@@ -180,8 +180,8 @@ public static boolean matchAsciiBuffer(final String expected, final byte[] buffe
* been read from a corrupted input.
* </p>
*
- * @param s the string to sanitize
- * @return a sanitized version of the argument
+ * @param s the string to sanitize.
+ * @return a sanitized version of the argument.
* @since 1.12
*/
public static String sanitize(final String s) {
@@ -207,8 +207,8 @@ public static String sanitize(final String s) {
/**
* Convert a string to ASCII bytes. Used for comparing "magic" strings which need to be independent of the default Locale.
*
- * @param inputString string to convert
- * @return the bytes
+ * @param inputString string to convert.
+ * @return the bytes.
*/
public static byte[] toAsciiBytes(final String inputString) {
return inputString.getBytes(US_ASCII);
@@ -217,8 +217,8 @@ public static byte[] toAsciiBytes(final String inputString) {
/**
* Convert an input byte array to a String using the ASCII character set.
*
- * @param inputBytes bytes to convert
- * @return the bytes, interpreted as an ASCII string
+ * @param inputBytes bytes to convert.
+ * @return the bytes, interpreted as an ASCII string.
*/
public static String toAsciiString(final byte[] inputBytes) {
return new String(inputBytes, US_ASCII);
@@ -227,10 +227,10 @@ public static String toAsciiString(final byte[] inputBytes) {
/**
* Convert an input byte array to a String using the ASCII character set.
*
- * @param inputBytes input byte array
- * @param offset offset within array
- * @param length length of array
- * @return the bytes, interpreted as an ASCII string
+ * @param inputBytes input byte array.
+ * @param offset offset within array.
+ * @param length length of array.
+ * @return the bytes, interpreted as an ASCII string.
*/
public static String toAsciiString(final byte[] inputBytes, final int offset, final int length) {
return new String(inputBytes, offset, length, US_ASCII);
@@ -246,8 +246,8 @@ public static String toAsciiString(final byte[] inputBytes, final int offset, fi
* d 100 testfiles
* </pre>
*
- * @param entry the entry
- * @return the representation of the entry
+ * @param entry the entry.
+ * @return the representation of the entry.
*/
public static String toString(final ArchiveEntry entry) {
final StringBuilder sb = new StringBuilder();