|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--monrovia.protocol.ByteConverter
ByteConverter converts to and from byteArrays
Constructor Summary | |
ByteConverter(byte[] pData)
Constructs a new byteconverter with the specified array |
|
ByteConverter(byte[][] pData)
Construct a byte array from bitmaps |
|
ByteConverter(Command[] pData)
Construct a byte array from commands |
|
ByteConverter(int pDataSize)
Constructor allocates an empty array with specified size |
|
ByteConverter(int[][] pData)
Construct a byte array from a map |
|
ByteConverter(Stat[] pData)
Construct a byte array from stats |
|
ByteConverter(java.lang.String[] pData)
|
Method Summary | |
static int |
bitmapSize(byte[][] pData)
calculates the size of the bitmaps each bitmap: 16 * 16, 8bit color |
int |
bytesToInt(int pOffset)
Convert bytes at offset to an int |
short |
bytesToShort(int pOffset)
Convert bytes at offset to a short |
java.lang.String |
bytesToString(int pOffset)
Convert a byte array at offset to a string |
java.lang.String |
bytesToString(int pOffset,
int pLength)
Convert a byte array from offset to offset + length to a string |
static int |
commandSize(Command[] pData)
calculates the size of the commands each command: 4 id,16 name,1 type |
static int |
commandSize(java.lang.String[] pData)
|
byte |
getByte(int pOffset)
returns a byte at offset |
Command |
getCommand(int pOffset)
getCommand gets a single command from offset |
Command[] |
getCommandArray()
getCommandArray gets the commands from the bytearray and returns them as an array of commands |
java.util.Hashtable |
getCommands()
getCommands gets the commands from the bytearray and returns them in a hashtable |
byte[] |
getData()
returns the underlying byte array |
short[][] |
getShortMap()
returns the map (array of array of shorts) from the bytearray |
int |
getSize()
returns the size of the underlying byte array |
void |
intToBytes(int pInt,
int pOffset)
Convert an int to bytes at offset |
static int |
mapSize(int[][] pData)
calculates the size fo a map required for transport 2 x dimension, 2 y dimension, bitmapids |
void |
setByte(byte pByte,
int pOffset)
sets a byte at offset |
void |
setBytes(byte[] pBytes,
int pOffset)
sets bytes with length at offset |
void |
shortToBytes(short pShort,
int pOffset)
Convert a short to bytes at offset |
static int |
statSize(Stat[] pData)
calculates the size of the stats each stat: 16 name, 1 type, 16 value |
void |
stringToBytes(java.lang.String pString,
int pOffset)
Convert a string to bytes at offset |
void |
stringToBytes(java.lang.String pString,
int pOffset,
int pLength)
Convert a string to bytes at offset with max length |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ByteConverter(int pDataSize)
pDataSize
- size of the array to be allocatedpublic ByteConverter(byte[] pData)
pData
- a byte[] to work withpublic ByteConverter(int[][] pData)
pData
- a map of type int[][]public ByteConverter(byte[][] pData)
pData
- a bitmaparraypublic ByteConverter(Command[] pData)
pData
- an array of commandspublic ByteConverter(java.lang.String[] pData)
public ByteConverter(Stat[] pData)
pData
- an array of StatsMethod Detail |
public short[][] getShortMap()
public Command[] getCommandArray()
public java.util.Hashtable getCommands()
public Command getCommand(int pOffset)
pOffset
- from where to extract the commandpublic byte[] getData()
public int getSize()
public int bytesToInt(int pOffset)
pOffset
- the position where the int ispublic short bytesToShort(int pOffset)
pOffset
- the position where the short ispublic byte getByte(int pOffset)
pOffset
- the position where the byte ispublic void intToBytes(int pInt, int pOffset)
pInt
- the int that is copied into the arraypOffset
- the position where pInt should gopublic void shortToBytes(short pShort, int pOffset)
pShort
- the short that is copied into the arraypOffset
- the position where the pShort should gopublic void setByte(byte pByte, int pOffset)
pByte
- sets a bytepOffset
- the position of the bytepublic void setBytes(byte[] pBytes, int pOffset)
pBytes
- the bytes to be setpOffset
- the offset in the target arraypublic void stringToBytes(java.lang.String pString, int pOffset)
pString
- the string to be setthe
- position where its goingpublic void stringToBytes(java.lang.String pString, int pOffset, int pLength)
pString
- the string ot be set into the arraythe
- position in the arraylength
- (how much of the string should go at max)public java.lang.String bytesToString(int pOffset)
pOffset
- the starting positionpublic java.lang.String bytesToString(int pOffset, int pLength)
pOffset
- the staring positionpLength
- how much will be copiedpublic static int mapSize(int[][] pData)
pData
- the array of int arrays where the map liespublic static int bitmapSize(byte[][] pData)
pData
- the array of bitmapspublic static int commandSize(Command[] pData)
pData
- the array of commands containing the commandspublic static int commandSize(java.lang.String[] pData)
public static int statSize(Stat[] pData)
pData
- the array of stats
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |