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.

WARNING: THIS CLASS IS SHARED BETWEEN THE classes AND pccomms PROJECTS. DO NOT EDIT THE VERSION IN pccomms AS IT WILL BE OVERWRITTEN WHEN THE PROJECT IS BUILT.


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
clone, equals, finalize, 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