org.apache.tools.zip
Class ZipLong
java.lang.Objectorg.apache.tools.zip.ZipLong
- Cloneable
public final class ZipLong
extends java.lang.Object
implements Cloneable
Utility class that represents a four byte integer with conversion
rules for the big endian byte order of ZIP files.
ZipLong(byte[] bytes)- Create instance from bytes.
|
ZipLong(byte[] bytes, int offset)- Create instance from the four bytes starting at offset.
|
ZipLong(long value)- Create instance from a number.
|
boolean | equals(Object o)- Override to make two instances with same value equal.
|
byte[] | getBytes()- Get value as four bytes in big endian byte order.
|
static byte[] | getBytes(long value)- Get value as four bytes in big endian byte order.
|
long | getValue()- Get value as Java long.
|
static long | getValue(byte[] bytes)- Helper method to get the value as a Java long from a four-byte array
|
static long | getValue(byte[] bytes, int offset)- Helper method to get the value as a Java long from four bytes starting at given array offset
|
int | hashCode()- Override to make two instances with same value equal.
|
ZipLong
public ZipLong(byte[] bytes)
Create instance from bytes.
bytes - the bytes to store as a ZipLong
ZipLong
public ZipLong(byte[] bytes,
int offset) Create instance from the four bytes starting at offset.
bytes - the bytes to store as a ZipLongoffset - the offset to start
ZipLong
public ZipLong(long value)
Create instance from a number.
value - the long to store as a ZipLong
equals
public boolean equals(Object o)
Override to make two instances with same value equal.
- true if the objects are equal
getBytes
public byte[] getBytes()
Get value as four bytes in big endian byte order.
- value as four bytes in big endian order
getBytes
public static byte[] getBytes(long value)
Get value as four bytes in big endian byte order.
value - the value to convert
- value as four bytes in big endian byte order
getValue
public long getValue()
Get value as Java long.
getValue
public static long getValue(byte[] bytes)
Helper method to get the value as a Java long from a four-byte array
bytes - the array of bytes
- the correspondanding Java long value
getValue
public static long getValue(byte[] bytes,
int offset) Helper method to get the value as a Java long from four bytes starting at given array offset
bytes - the array of bytesoffset - the offset to start
- the correspondanding Java long value
hashCode
public int hashCode()
Override to make two instances with same value equal.
- the value stored in the ZipLong