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