public class Binary extends Object implements Cloneable
Constructor and Description |
---|
Binary(Binary other)
Create an empty copy of another binary.
|
Binary(int len,
int mask_bits)
Create a binary object of the specified length
|
Binary(String p21str)
Create a Binary object from a Part21-encoded string.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Create a copy of this object
|
boolean |
equals(Object o)
Determines if two binaries contain the same values
|
byte |
get(int index)
Get a sequence of 8 bits from the binary object.
|
int |
getMaskedBits()
Gets the number of extra bits in the binary
|
int |
hashCode()
Get the has code for this object.
|
boolean |
isEmpty()
Determine if this object is empty.
|
void |
set(int index,
byte value)
Set a sequence of 8 bits from the binary object.
|
int |
size()
Gets the size (in bytes) of the binary.
|
int |
sizeInBits()
Determines the length of the binary in bits
|
int |
sizeInBytes()
Determines the length of the binary in bytes
|
String |
toString()
Convert the binary to a string as specified in Part 21
|
public Binary(String p21str) throws BinarySyntaxException
p21str
- A string representation for the binary. This consists of a
set of hex digits. The first digit indicates how many of the bits in
the second digit are signifigant. Each character in the rest of the
string represents four bits of the binary value.BinarySyntaxException
public Binary(int len, int mask_bits)
len
- The requested length for the binary in bytes.mask_bits
- Number of bits to ignore.public Binary(Binary other)
other
- The object getting copied.public byte get(int index)
index
- The index of the byte to retreive.IndexOutOfBoundsException
public void set(int index, byte value)
index
- The index of the byte to retreive.value
- The value to be set.IndexOutOfBoundsException
public int size()
public int sizeInBits()
public int sizeInBytes()
public int getMaskedBits()
public boolean isEmpty()
public boolean equals(Object o)
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public int hashCode()