public static void main( String[] argv ) {

	//String msg = "Hallo, das ist ein Test.";
	//byte[] data = msg.getBytes();
	

	byte[] data = new byte[256];
	for( int i = 0; i < data.length; i++ ) 
	    data[i] = (byte)i;

	int size = data.length;

	System.out.println( "Creating buffer (size="+ size + ") ..." );
	CircularFIFO buffer = new CircularFIFO( size );
	System.out.println( "buffer=" + buffer );

	
	System.out.println( "Adding message bytes '" + new String(data) + "' ... ");
	for( int i = 0; i < data.length; i++ ) {
	    buffer.write( data[i] );
	}
	System.out.println( "buffer=" + buffer );

	
	System.out.println( "Peeking into the buffer ... " );
	for( int i = 0; i < buffer.length(); i++ )
	    System.out.print( " " + buffer.peek(i) );


	System.out.println( "Reading bytes (A), then re-writing ... " );
	for( int i = 0; i < data.length/2; i++ ) {
	    byte b = buffer.read();
	    System.out.print( " " + b  );
	    buffer.write( b );
	}

	
	System.out.println( "Peeking into the buffer (again)... " );
	for( int i = 0; i < buffer.length(); i++ )
	    System.out.print( " " + buffer.peek(i) );


	System.out.println( "\nReading bytes (B) ... " );
	while( buffer.length() > 0 )
	    System.out.print( " " + buffer.read() );

	System.out.println( "\nDone." );

    }