Package com.chemaxon.descriptors.common
Enum BinaryVectors.Endianness
- java.lang.Object
-
- java.lang.Enum<BinaryVectors.Endianness>
-
- com.chemaxon.descriptors.common.BinaryVectors.Endianness
-
- All Implemented Interfaces:
Serializable
,Comparable<BinaryVectors.Endianness>
- Enclosing class:
- BinaryVectors
public static enum BinaryVectors.Endianness extends Enum<BinaryVectors.Endianness>
Order of components in packed representations.- See Also:
- http://en.wikipedia.org/wiki/Endianness
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BIG_ENDIAN
Decreasing numeric significance with increasing addresses/indices.LITTLE_ENDIAN
Increasing numeric significance with increasing addresses/indices.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
appendLongAsBinaryString(StringBuilder b, long l)
Convert 64 bit long to binary string.abstract int
packBytesToInt(byte[] buffer, int firstIndex)
Pack four 8 bit bytes into a 32 bit int.int
packBytesToInt(byte b0, byte b1, byte b2, byte b3)
Pack four 8 bit bytes into a 32 bit int.abstract long
packBytesToLong(byte[] buffer, int firstIndex)
Pack eight 8 bit bytes into a 64 bit long.long
packBytesToLong(byte b0, byte b1, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7)
Pack eight 8 bit bytes into a 64 bit long.abstract int
packIntIntoBitSet(int i, BitSet b, int start)
Pack an int value into a BitSet.abstract long
packIntsToLong(int i0, int i1)
Pack two 32 bit integers into a 64 bit long.abstract int
packLongIntoBitSet(long l, BitSet b, int start)
Pack a long value into a BitSet.abstract long
parseBinaryStringAsLong(String s)
Parse a binary String as a 64 bit long.byte[]
unpackBytesFromInt(int i)
Unpack four 8 bit bytes from a 32 bit int.abstract void
unpackBytesFromInt(int i, byte[] buffer, int firstIndex)
Unpack four 8 bit bytes from a 32 bit int.byte[]
unpackBytesFromLong(long l)
Unpack eight 8 bit bytes from a 64 bit long.abstract void
unpackBytesFromLong(long l, byte[] buffer, int firstIndex)
Unpack eight 8 bit bytes from a 64 bit long.abstract int
unpackInt0FromLong(long l)
Unpack first 32 bit integer from a 64 bit long according to the represented endianness.abstract int
unpackInt1FromLong(long l)
Unpack second 32 bit integer from a 64 bit long according to the represented endianness.abstract int
unpackIntFromBitSet(BitSet b, int start)
Unpack an int value from a BitSet.abstract long
unpackLongFromBitSet(BitSet b, int start)
Unpack a long value from a BitSet.static BinaryVectors.Endianness
valueOf(String name)
Returns the enum constant of this type with the specified name.static BinaryVectors.Endianness[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
BIG_ENDIAN
public static final BinaryVectors.Endianness BIG_ENDIAN
Decreasing numeric significance with increasing addresses/indices.Most significant part first.
-
LITTLE_ENDIAN
public static final BinaryVectors.Endianness LITTLE_ENDIAN
Increasing numeric significance with increasing addresses/indices.Least significant part first.
-
-
Method Detail
-
values
public static BinaryVectors.Endianness[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (BinaryVectors.Endianness c : BinaryVectors.Endianness.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static BinaryVectors.Endianness valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
packIntsToLong
public abstract long packIntsToLong(int i0, int i1)
Pack two 32 bit integers into a 64 bit long.- Parameters:
i0
- First integer, associated with lower index/addressi1
- Second integer, associated with higher index/address- Returns:
- Packed long
-
unpackInt0FromLong
public abstract int unpackInt0FromLong(long l)
Unpack first 32 bit integer from a 64 bit long according to the represented endianness.- Parameters:
l
- Packed long- Returns:
- Integer associated with the lower index/address
-
unpackInt1FromLong
public abstract int unpackInt1FromLong(long l)
Unpack second 32 bit integer from a 64 bit long according to the represented endianness.- Parameters:
l
- Packed long- Returns:
- Integer associated with the higher index/address
-
packBytesToLong
public long packBytesToLong(byte b0, byte b1, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7)
Pack eight 8 bit bytes into a 64 bit long.- Parameters:
b0
- First byte, associated with lowest index/addressb1
- Second byteb2
- Third byteb3
- Fourth byteb4
- Fifth byteb5
- Sixth byteb6
- Seventh byteb7
- Eighth byte, associated with the highest index/address- Returns:
- Packed long
-
packBytesToInt
public int packBytesToInt(byte b0, byte b1, byte b2, byte b3)
Pack four 8 bit bytes into a 32 bit int.- Parameters:
b0
- First byte, associated with lowest index/addressb1
- Second byteb2
- Third byteb3
- Fourth byte, associated with the highest index/address- Returns:
- Packed int
-
packBytesToLong
public abstract long packBytesToLong(byte[] buffer, int firstIndex)
Pack eight 8 bit bytes into a 64 bit long.- Parameters:
buffer
- Buffer containing bytes to packfirstIndex
- Index of the first byte to pack in the buffer- Returns:
- Packed long; bytes from the given array; from given index to (including) given index + 7 are packed
-
packBytesToInt
public abstract int packBytesToInt(byte[] buffer, int firstIndex)
Pack four 8 bit bytes into a 32 bit int.- Parameters:
buffer
- Buffer containing bytes to packfirstIndex
- Index of the first byte to pack in the buffer- Returns:
- Packed int; bytes from the given array; from given index to (including) given index + 3 are packed
-
unpackBytesFromLong
public byte[] unpackBytesFromLong(long l)
Unpack eight 8 bit bytes from a 64 bit long.- Parameters:
l
- Packed long- Returns:
- Array of 8 bytes. Index 0 is associated with the lowest index/address.
-
unpackBytesFromInt
public byte[] unpackBytesFromInt(int i)
Unpack four 8 bit bytes from a 32 bit int.- Parameters:
i
- Packed int- Returns:
- Array of 4 bytes. Index 0 is associated with the lowest index/address.
-
unpackBytesFromLong
public abstract void unpackBytesFromLong(long l, byte[] buffer, int firstIndex)
Unpack eight 8 bit bytes from a 64 bit long.- Parameters:
l
- Packed longbuffer
- target bufferfirstIndex
- Index of the first byte to write in the buffer (associated with the lowest index/address)
-
unpackBytesFromInt
public abstract void unpackBytesFromInt(int i, byte[] buffer, int firstIndex)
Unpack four 8 bit bytes from a 32 bit int.- Parameters:
i
- Packed intbuffer
- target bufferfirstIndex
- Index of the first byte to write in the buffer (associated with the lowest index/address)
-
parseBinaryStringAsLong
public abstract long parseBinaryStringAsLong(String s)
Parse a binary String as a 64 bit long.- Parameters:
s
- Binary String to parse- Returns:
- parsef long
- Throws:
IllegalArgumentException
- when parameter String length differs from 64 or contains other than '0' and '1' characters
-
appendLongAsBinaryString
public abstract void appendLongAsBinaryString(StringBuilder b, long l)
Convert 64 bit long to binary string.- Parameters:
b
- Target buffer to write tol
- Long to convert
-
unpackIntFromBitSet
public abstract int unpackIntFromBitSet(BitSet b, int start)
Unpack an int value from a BitSet.- Parameters:
b
- Source BitSet.start
- Position of first bit to read in the BitSet- Returns:
- Unpacked int.
-
unpackLongFromBitSet
public abstract long unpackLongFromBitSet(BitSet b, int start)
Unpack a long value from a BitSet.- Parameters:
b
- Source BitSet.start
- Position of first bit to read in the BitSet- Returns:
- Unpacked long.
-
packIntIntoBitSet
public abstract int packIntIntoBitSet(int i, BitSet b, int start)
Pack an int value into a BitSet.- Parameters:
i
- Value to packb
- Target BitSetstart
- Position of the first bit to write- Returns:
- Position of first bit to write by a subsequent pack
-
packLongIntoBitSet
public abstract int packLongIntoBitSet(long l, BitSet b, int start)
Pack a long value into a BitSet.- Parameters:
l
- Value to packb
- Target BitSetstart
- Position of the first bit to write- Returns:
- Position of first bit to write by a subsequent pack
-
-