net.sourceforge.jwap.wsp
Class WSPDecoder
java.lang.Object
|
+--net.sourceforge.jwap.wsp.WSPDecoder
- public class WSPDecoder
- extends java.lang.Object
This class can be used to extract WSP Primitives from a byte array. The decoder
maintains a pointer (index) into the byte array which is increased when
calling one of the getter-methods. E.g. calling getUint8() to read a
octet will increase the index by one.
- Author:
- Michel Marti
Constructor Summary |
WSPDecoder(byte[] data)
Construct a new WSP Decoder |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WSPDecoder
public WSPDecoder(byte[] data)
- Construct a new WSP Decoder
- Parameters:
data
- the data to operate on
getOctet
public byte getOctet()
getUint8
public short getUint8()
getUint16
public int getUint16()
getUint32
public int getUint32()
getUintVar
public long getUintVar()
getCString
public java.lang.String getCString()
getTextString
public java.lang.String getTextString()
getBytes
public byte[] getBytes(int count)
isEOF
public boolean isEOF()
getRemainingOctets
public int getRemainingOctets()
seek
public int seek(int offset)
- Modify the array index
- Parameters:
offset
- the offset (might be negative to seek backwards)- Returns:
- the new position of the index
pos
public int pos(int position)
pos
public int pos()
getString
public java.lang.String getString(int length)
getIntegerValue
public long getIntegerValue()
- Returns a short- or long-integer
getValueLength
public long getValueLength()
getShortInteger
public short getShortInteger()
getLongInteger
public long getLongInteger()
getDateValue
public java.util.Date getDateValue()
isShortInteger
public boolean isShortInteger()
- isShortInteger tests if the next value is a short int.
isLongInteger
public boolean isLongInteger()
isString
public boolean isString()
- isString tests if the next value is a string.