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 2024/11/26 15:41:06 UTC
(commons-compress) 01/04: Use a constant instead of a magic number
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 67335330759eca55144298964a2a2ca0dc6e72b3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Nov 26 10:27:34 2024 -0500
Use a constant instead of a magic number
---
.../apache/commons/compress/archivers/zip/ZipEightByteInteger.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
index 2d1cd6545..dac4b958d 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
@@ -30,6 +30,8 @@ import java.nio.ByteOrder;
*/
public final class ZipEightByteInteger implements Serializable {
+ private static final int BYTES = 8;
+
private static final long serialVersionUID = 1L;
/**
@@ -56,7 +58,7 @@ public final class ZipEightByteInteger implements Serializable {
* @return value as eight bytes in big-endian byte order
*/
public static byte[] getBytes(final long value) {
- final ByteBuffer buffer = ByteBuffer.allocate(8).order(ByteOrder.LITTLE_ENDIAN);
+ final ByteBuffer buffer = ByteBuffer.allocate(BYTES).order(ByteOrder.LITTLE_ENDIAN);
buffer.putLong(value);
return buffer.array();
}