fipaos.parser.acl.bitefficient
Class BinRep

java.lang.Object
  |
  +--fipaos.parser.acl.bitefficient.BinRep
Direct Known Subclasses:
BinDate, BinNumber

public class BinRep
extends java.lang.Object

Conversion between ASCII numbers and bit-efficient numbers. The coding is based on following rules:
'0' = 0001 (0x01)
'1' = 0010 (0x02)
'2' = 0011 (0x03)
'3' = 0100 (0x04)
'4' = 0101 (0x05)
'5' = 0110 (0x06)
'6' = 0111 (0x07)
'7' = 1000 (0x08)
'8' = 1001 (0x09)
'9' = 1010 (0x0a)
'+' = 1100 (0x0c)
'e' = 1101 (0x0d)
'-' = 1110 (0x0e)
'.' = 1111 (0x0f)

Author:
Heikki Helin, Mikko Laukkanen

Constructor Summary
BinRep()
           
 
Method Summary
protected static byte decode(int i)
          Converts bit-efficient number to ASCII.
protected static byte encode(int i)
          Converts one ASCII number to bit-efficient representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinRep

public BinRep()
Method Detail

encode

protected static byte encode(int i)
Converts one ASCII number to bit-efficient representation. The ASCII number to convert must be such number that conversion can be done (check the list above). If the ASCII number is not in given range, the result of this method is undefined (i.e., no validity checks are done).
Parameters:
i - ASCII number to convert
Returns:
Corresponding bit-efficient number

decode

protected static byte decode(int i)
Converts bit-efficient number to ASCII. The number to convert must be valid bit-efficient number (i.e., number between 0x00-0x0f). No validity checks are done.
Parameters:
i - bit-efficient number to convert
Returns:
Corresponding ASCII number