net.datacrow.util.cuecat
Class CueCatDecoder

java.lang.Object
  extended by net.datacrow.util.cuecat.CueCatDecoder

public class CueCatDecoder
extends java.lang.Object

This class handles decoding a line of CueCat output and creating a CueCatCode object to store that data. CueCat output consists of 3 period separated pieces of information, simialr to this:

.C3nZC3nZC3nYDhv7D3DWCxnX.cGf2.ENr7C3b3DNbWChPXDxzZDNP6.

The first item is the CueCat device ID. The second is the barcode type. The third is the actual bar code that was scanned.

This class can be used to parse each item separately or all at once, returning Strings or a CueCatCode.

The following is the process that is used to undo the encoding performed by the CueCat:

Version:
1.0
Author:
Tim Patton (guinsu@timpatton.com)

Constructor Summary
CueCatDecoder()
           
 
Method Summary
static CueCatCode decodeLine(java.lang.String s)
          Decode a while line of CueCat outout and create a CueCatCode object.
static java.lang.String decodeToken(java.lang.String encoded)
          Decodes one item fromthe CueCat output
static char[] padInput(java.lang.String encoded)
          Adds '=' symbols to the end of any input until its length is evenly divisible by 4
static void swapUpperLower(char[] chars)
          Swap upper case to lower case and vice versa, minuses to slashes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CueCatDecoder

public CueCatDecoder()
Method Detail

decodeToken

public static java.lang.String decodeToken(java.lang.String encoded)
Decodes one item fromthe CueCat output

Parameters:
encoded - the CueCat encoded item, with no periods
Returns:
the decoded String

swapUpperLower

public static void swapUpperLower(char[] chars)
Swap upper case to lower case and vice versa, minuses to slashes. This method modifies the input array

Parameters:
chars - the character array to convert

decodeLine

public static CueCatCode decodeLine(java.lang.String s)
Decode a while line of CueCat outout and create a CueCatCode object. This method only processes the first three period separated items, anything after is ignored.

Parameters:
s - the line if input from the CueCat
Returns:
a CueCatCode object holding all the parsed data

padInput

public static char[] padInput(java.lang.String encoded)
Adds '=' symbols to the end of any input until its length is evenly divisible by 4

Parameters:
encoded - the String to be padded out
Returns:
a new char[] of the correct length