Methods Summary |
---|
public boolean | equals(java.lang.Object o)Override to make two instances with same value equal.
if (o == null || !(o instanceof ZipLong)) {
return false;
}
return value == ((ZipLong) o).getValue();
|
public byte[] | getBytes()Get value as four bytes in big endian byte order.
return ZipLong.getBytes(value);
|
public static byte[] | getBytes(long value)Get value as four bytes in big endian byte order.
byte[] result = new byte[4];
result[0] = (byte) ((value & 0xFF));
result[1] = (byte) ((value & 0xFF00) >> 8);
result[2] = (byte) ((value & 0xFF0000) >> 16);
result[3] = (byte) ((value & 0xFF000000L) >> 24);
return result;
|
public long | getValue()Get value as Java long.
return value;
|
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
long value = (bytes[offset + 3] << 24) & 0xFF000000L;
value += (bytes[offset + 2] << 16) & 0xFF0000;
value += (bytes[offset + 1] << 8) & 0xFF00;
value += (bytes[offset] & 0xFF);
return value;
|
public static long | getValue(byte[] bytes)Helper method to get the value as a Java long from a four-byte array
return getValue(bytes, 0);
|
public int | hashCode()Override to make two instances with same value equal.
return (int) value;
|