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/08/02 13:05:15 UTC
(commons-compress) 03/08: 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 47ca223b417d7e548c33bf42d0f68ad0046f2bcf
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sat Aug 2 07:34:40 2025 -0400
Javadoc
---
.../commons/compress/archivers/sevenz/SevenZFile.java | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
index be9b96f3c..198f56bf5 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
@@ -339,9 +339,17 @@ public Builder setUseDefaultNameForUnnamedEntries(final boolean useDefaultNameFo
static final byte[] sevenZSignature = { // NOSONAR
(byte) '7', (byte) 'z', (byte) 0xBC, (byte) 0xAF, (byte) 0x27, (byte) 0x1C };
- private static int assertFitsIntoNonNegativeInt(final String what, final long value) throws IOException {
+ /**
+ * Throws IOException if the given value is not in {@code [0, Integer.MAX_VALUE]}.
+ *
+ * @param description A description for the IOException.
+ * @param value The value to check.
+ * @return The given value as an int.
+ * @throws IOException Thrown if the given value is not in {@code [0, Integer.MAX_VALUE]}.
+ */
+ private static int assertFitsIntoNonNegativeInt(final String description, final long value) throws IOException {
if (value > Integer.MAX_VALUE || value < 0) {
- throw new IOException(String.format("Cannot handle %s %,d", what, value));
+ throw new IOException(String.format("Cannot handle %s %,d", description, value));
}
return (int) value;
}
@@ -380,6 +388,13 @@ private static long getLong(final ByteBuffer buf) throws EOFException {
return checkEndOfFile(buf, Long.BYTES).getLong();
}
+ /**
+ * Gets the next unsigned byte as an int.
+ *
+ * @param buf the byte source.
+ * @return the next unsigned byte as an int.
+ * @throws EOFException Thrown if the given buffer doesn't have a remaining byte.
+ */
private static int getUnsignedByte(final ByteBuffer buf) throws EOFException {
if (!buf.hasRemaining()) {
throw new EOFException();