import java.lang.*;
import java.io.*;
import java.awt.Toolkit;
import CatDecoder.*;

public class Cattest1
{
static public void main( String[] args )
{

// Instantiate a CatDecoder object
CatDecoder CD = new CatDecoder();

boolean Anygood;

while( true ) {

System.out.println( "Enter the :Cue:Cat string you wish to decode" );
System.out.print( " (or just press ENTER to quit)" );
byte[] inbytes = new byte[80];
int    incount = 0;

// Get an input string from stdin
try {
    incount = System.in.read( inbytes, 0, 80 );
    }
	catch (IOException ex) {
		System.out.println( ex );
		System.exit(3);
		}

// If the input string is empty, then just quit
if ( incount == 0 ) System.exit(0);
String	sb2 = new String( inbytes );
if ( sb2.trim().length() == 0 ) System.exit(0);

// We will try to decode the string - "Beep" to tell the user we got one
Toolkit.getDefaultToolkit().beep();

// Give the input string to the CatDecoder, see if Mikey likes it.
Anygood = CD.CatDecode( sb2 );

// Tell the user how it worked.
System.out.println();
System.out.println( "String is .....: '" + sb2.trim() + "'." );
System.out.println( "Anygood = .....:  " + Anygood );
System.out.println( "Serial # is ...: '" + CD.getSerialNumber() + "'." );
System.out.println( "Barcode type is: '" + CD.getBarcodeType() + "'." );
System.out.println( "Scan data is ..: '" + CD.getScanData() + "'." );
System.out.println();

} // end while ( true )

// System.exit(0);

}  // end of main

}  // end of Cattest1 class