lejos.nxt.remote
Class AsciizCodec

java.lang.Object
  extended by lejos.nxt.remote.AsciizCodec

public class AsciizCodec
extends Object

Methods to encode and decode ASCIIZ. ASCIIZ is ASCII terminated by Zero.


Method Summary
static String decode(byte[] bytes)
          Convert an ASCIIZ byte array to a string
static byte[] encode(String str)
          Encode a string as ASCIIZ
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encode

public static byte[] encode(String str)
                     throws UnsupportedEncodingException
Encode a string as ASCIIZ

Parameters:
str - the string
Returns:
the ASCIIZ-encoded byte array
Throws:
UnsupportedEncodingException

decode

public static String decode(byte[] bytes)
                     throws UnsupportedEncodingException
Convert an ASCIIZ byte array to a string

Parameters:
bytes - the byte array
Returns:
the String
Throws:
UnsupportedEncodingException