-
- All Implemented Interfaces:
-
java.io.Serializable,java.lang.Cloneable
public final class ZipLong implements Cloneable, Serializable
Utility class that represents a four byte integer with conversion rules for the little endian byte order of ZIP files.
-
-
Method Summary
Modifier and Type Method Description static longgetValue(Array<byte> bytes)Helper method to get the value as a Java long from a four-byte array static longgetValue(Array<byte> bytes)Helper method to get the value as a Java long from a four-byte array static Array<byte>getBytes(long value)Get value as four bytes in big endian byte order. static voidputLong(long value, Array<byte> buf, int offset)put the value as four bytes in big endian byte order. Objectclone()booleanequals(Object o)Override to make two instances with same value equal. Array<byte>getBytes()Get value as four bytes in big endian byte order. intgetIntValue()Get value as a (signed) java int inthashCode()Override to make two instances with same value equal. voidputLong(Array<byte> buf, int offset)StringtoString()-
-
Constructor Detail
-
ZipLong
ZipLong(Array<byte> bytes)
Create instance from bytes.- Parameters:
bytes- the bytes to store as a ZipLong
-
ZipLong
ZipLong(Array<byte> bytes, int offset)
Create instance from the four bytes starting at offset.- Parameters:
bytes- the bytes to store as a ZipLongoffset- the offset to start
-
ZipLong
ZipLong(int value)
create instance from a java int.- Parameters:
value- the int to store as a ZipLong
-
ZipLong
ZipLong(long value)
Create instance from a number.- Parameters:
value- the long to store as a ZipLong
-
-
Method Detail
-
getValue
static long getValue(Array<byte> bytes)
Helper method to get the value as a Java long from a four-byte array
- Parameters:
bytes- the array of bytes
-
getValue
static long getValue(Array<byte> bytes)
Helper method to get the value as a Java long from a four-byte array
- Parameters:
bytes- the array of bytes
-
getBytes
static Array<byte> getBytes(long value)
Get value as four bytes in big endian byte order.
- Parameters:
value- the value to convert
-
putLong
static void putLong(long value, Array<byte> buf, int offset)
put the value as four bytes in big endian byte order.
- Parameters:
value- the Java long to convert to bytesbuf- the output bufferoffset- The offset within the output buffer of the first byte to be written.
-
equals
boolean equals(Object o)
Override to make two instances with same value equal.
- Parameters:
o- an object to compare
-
getIntValue
int getIntValue()
Get value as a (signed) java int
-
hashCode
int hashCode()
Override to make two instances with same value equal.
-
-
-
-