-
- All Implemented Interfaces:
-
java.io.Serializable
public final class ZipEightByteInteger implements Serializable
Utility class that represents an eight byte integer with conversion rules for the little endian byte order of ZIP files.
-
-
Field Summary
Fields Modifier and Type Field Description public final static ZipEightByteIntegerZEROprivate final BigIntegervalue
-
Constructor Summary
Constructors Constructor Description ZipEightByteInteger(BigInteger value)Create instance from a number. ZipEightByteInteger(Array<byte> bytes)Create instance from bytes. ZipEightByteInteger(Array<byte> bytes, int offset)Create instance from the eight bytes starting at offset. ZipEightByteInteger(long value)Create instance from a number.
-
Method Summary
Modifier and Type Method Description static BigIntegergetValue(Array<byte> bytes)Helper method to get the value as a Java long from an eight-byte array static BigIntegergetValue(Array<byte> bytes)Helper method to get the value as a Java long from an eight-byte array static Array<byte>getBytes(BigInteger value)Get value as eight bytes in big endian byte order. static Array<byte>getBytes(long value)Get value as eight bytes in big endian byte order. static longgetLongValue(Array<byte> bytes)Helper method to get the value as a Java long from an eight-byte array static longgetLongValue(Array<byte> bytes, int offset)Helper method to get the value as a Java long from eight bytesstarting at given array offset booleanequals(Object o)Override to make two instances with same value equal. Array<byte>getBytes()Get value as eight bytes in big endian byte order. longgetLongValue()Get value as Java long. inthashCode()Override to make two instances with same value equal. StringtoString()-
-
Constructor Detail
-
ZipEightByteInteger
ZipEightByteInteger(BigInteger value)
Create instance from a number.- Parameters:
value- the BigInteger to store as a ZipEightByteInteger
-
ZipEightByteInteger
ZipEightByteInteger(Array<byte> bytes)
Create instance from bytes.- Parameters:
bytes- the bytes to store as a ZipEightByteInteger
-
ZipEightByteInteger
ZipEightByteInteger(Array<byte> bytes, int offset)
Create instance from the eight bytes starting at offset.- Parameters:
bytes- the bytes to store as a ZipEightByteIntegeroffset- the offset to start
-
ZipEightByteInteger
ZipEightByteInteger(long value)
Create instance from a number.- Parameters:
value- the long to store as a ZipEightByteInteger
-
-
Method Detail
-
getValue
static BigInteger getValue(Array<byte> bytes)
Helper method to get the value as a Java long from an eight-byte array
- Parameters:
bytes- the array of bytes
-
getValue
static BigInteger getValue(Array<byte> bytes)
Helper method to get the value as a Java long from an eight-byte array
- Parameters:
bytes- the array of bytes
-
getBytes
static Array<byte> getBytes(BigInteger value)
Get value as eight bytes in big endian byte order.
- Parameters:
value- the value to convert
-
getBytes
static Array<byte> getBytes(long value)
Get value as eight bytes in big endian byte order.
- Parameters:
value- the value to convert
-
getLongValue
static long getLongValue(Array<byte> bytes)
Helper method to get the value as a Java long from an eight-byte array
- Parameters:
bytes- the array of bytes
-
getLongValue
static long getLongValue(Array<byte> bytes, int offset)
Helper method to get the value as a Java long from eight bytesstarting at given array offset
- Parameters:
bytes- the array of bytesoffset- the offset to start
-
equals
boolean equals(Object o)
Override to make two instances with same value equal.
- Parameters:
o- an object to compare
-
getLongValue
long getLongValue()
Get value as Java long.
-
hashCode
int hashCode()
Override to make two instances with same value equal.
-
-
-
-