org.llrp.ltk.types
Class UnsignedByteArray

java.lang.Object
  extended by org.llrp.ltk.types.LLRPType
      extended by org.llrp.ltk.types.UnsignedByteArray
Direct Known Subclasses:
AirProtocolsArray, UnsignedByteArray_HEX

public class UnsignedByteArray
extends LLRPType

Array of unsigned bytes. Length encoded in first 16 bits of binary encoding


Field Summary
protected  UnsignedByte[] bytes
           
protected  boolean signed
           
protected  java.lang.Integer value
           
 
Constructor Summary
UnsignedByteArray()
          Creates an empty UnsignedByteArray.
UnsignedByteArray(byte[] bytes)
          Creates a new UnsignedByteArray object.
UnsignedByteArray(org.jdom.Element element)
          Creates a new UnsignedByteArray object from jdom element - used for xml decoding
UnsignedByteArray(int length)
          all values initially set to 0
UnsignedByteArray(LLRPBitList list)
          create ByteArray from BitList.
UnsignedByteArray(java.lang.String byteString)
          create a new UnsignedByteArray from String.
UnsignedByteArray(UnsignedByte[] bytes)
          Creates a new UnsignedByteArray object.
 
Method Summary
 void add(UnsignedByte aByte)
           
 void decodeBinary(LLRPBitList list)
          first 16 bits must be number of Bytes that follow
 void decodeXML(org.jdom.Element element)
          /** decode from XML
 LLRPBitList encodeBinary()
          encodes length before encoding containing values
 org.jdom.Content encodeXML(java.lang.String name, org.jdom.Namespace ns)
          encode to XML
 UnsignedByte get(int i)
          get UnsignedByte at specified position
 int getByteLength()
          number of bytes used to represent this type
 boolean inRange(java.lang.String valueString)
          expects a string as formated for XML
static int length()
          length of BaseType - not of the array - for array length call size()
 void set(int i, UnsignedByte b)
          set Byte at provided position to provided byte
 int size()
          number of elements in array
 java.lang.Integer toInteger()
          interpred this byte array as a single integer.
 java.lang.String toString()
          String representation
 java.lang.String toString(int radix)
           
 
Methods inherited from class org.llrp.ltk.types.LLRPType
toXMLString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bytes

protected UnsignedByte[] bytes

value

protected java.lang.Integer value

signed

protected boolean signed
Constructor Detail

UnsignedByteArray

public UnsignedByteArray(UnsignedByte[] bytes)
Creates a new UnsignedByteArray object.

Parameters:
bytes - to create UnsignedByteArray

UnsignedByteArray

public UnsignedByteArray(org.jdom.Element element)
Creates a new UnsignedByteArray object from jdom element - used for xml decoding

Parameters:
element - to be decoded

UnsignedByteArray

public UnsignedByteArray(int length)
all values initially set to 0

Parameters:
length - of array

UnsignedByteArray

public UnsignedByteArray()
Creates an empty UnsignedByteArray. Do not call methood 'set' on an empty array. Add an UnsignedByte by calling the add method


UnsignedByteArray

public UnsignedByteArray(LLRPBitList list)
create ByteArray from BitList. First 16 Bits must be length of ByteArray

Parameters:
list - to be decoded

UnsignedByteArray

public UnsignedByteArray(byte[] bytes)
Creates a new UnsignedByteArray object.

Parameters:
bytes - to create UnsignedByteArray

UnsignedByteArray

public UnsignedByteArray(java.lang.String byteString)
create a new UnsignedByteArray from String. Each character is interpreded as a hexadecimal digit and stored in one byte

Parameters:
byteString -
Method Detail

encodeBinary

public LLRPBitList encodeBinary()
encodes length before encoding containing values

Specified by:
encodeBinary in class LLRPType
Returns:
LLRPBitList

getByteLength

public int getByteLength()
number of bytes used to represent this type

Returns:
Integer

length

public static int length()
length of BaseType - not of the array - for array length call size()

Returns:
int

decodeBinary

public void decodeBinary(LLRPBitList list)
first 16 bits must be number of Bytes that follow

Specified by:
decodeBinary in class LLRPType
Parameters:
list - to be decoded

get

public UnsignedByte get(int i)
get UnsignedByte at specified position

Parameters:
i - position
Returns:
SignedByte

set

public void set(int i,
                UnsignedByte b)
set Byte at provided position to provided byte

Parameters:
i - position
b - byte to be set

size

public int size()
number of elements in array

Returns:
int

encodeXML

public org.jdom.Content encodeXML(java.lang.String name,
                                  org.jdom.Namespace ns)
encode to XML

Specified by:
encodeXML in class LLRPType
Parameters:
name - of element
ns - Namespace

decodeXML

public void decodeXML(org.jdom.Element element)
/** decode from XML

Specified by:
decodeXML in class LLRPType
Parameters:
element - to decode

add

public void add(UnsignedByte aByte)

toInteger

public java.lang.Integer toInteger()
interpred this byte array as a single integer. Each byte is interpred as a hexadecimal number, concatenated and the whole string is then transformed to a Java Integer

Returns:
Integer

toString

public java.lang.String toString(int radix)
Specified by:
toString in class LLRPType

toString

public java.lang.String toString()
Description copied from class: LLRPType
String representation

Overrides:
toString in class LLRPType
Returns:
String

inRange

public boolean inRange(java.lang.String valueString)
expects a string as formated for XML

Specified by:
inRange in class LLRPType


Copyright © 2007 ETH Zurich.