tapeutils
Interface ByteProcessor

All Known Implementing Classes:
SimpleByteProcessor

public interface ByteProcessor

This interface provides operations to process bytes.

Author:
hldswrth

Method Summary
 java.lang.String checkConsistent()
          Checks whether the loaded bytes are consistent.
 int getByteIndex(int number)
          Get the index in the sample for the given byte number.
 int getByteNumber(int index)
          Get the byte number at the given position in the sample.
 void getByteNumber(int index, int[] pos)
          Get the byte number at the given position in the sample.
 byte[] getBytes()
          Get all the bytes.
 int getByteValue(int byteNumber)
          Get the byte value at the given byte number.
 void initialize()
          Initialize this object ready for processing a sample.
 int numBytesProcessed()
          Returns the number of bytes processed.
 int numExpectedBytes()
          Returns the number of bytes expected to be processed.
 void processByte(int start, int end, int byteValue)
          Process the current byte.
 int undoLastByte()
          Undo the last byte that was extracted.
 void write(java.io.OutputStream output)
          Write the bytes that have been extracted from the sample to the output stream.
 

Method Detail

initialize

public void initialize()
Initialize this object ready for processing a sample.


processByte

public void processByte(int start,
                        int end,
                        int byteValue)
Process the current byte.

Parameters:
start - The start index of the byte in the sample.
end - The end index of the byte in the sample.
byteValue - The byte value.

undoLastByte

public int undoLastByte()
Undo the last byte that was extracted.

Returns:
The value of the last byte.

write

public void write(java.io.OutputStream output)
           throws java.io.IOException
Write the bytes that have been extracted from the sample to the output stream.

Parameters:
output - The output stream.
Throws:
java.io.IOException - An error occurred writing to the stream.

numBytesProcessed

public int numBytesProcessed()
Returns the number of bytes processed.

Returns:
The number of bytes processed.

numExpectedBytes

public int numExpectedBytes()
Returns the number of bytes expected to be processed.

Returns:
The number of bytes expected to be processed.

getByteNumber

public int getByteNumber(int index)
Get the byte number at the given position in the sample.

Parameters:
index - The position in the sample.
Returns:
The byte number, -1 for no byte.

getByteNumber

public void getByteNumber(int index,
                          int[] pos)
Get the byte number at the given position in the sample.

Parameters:
index - The index.
pos - An array which will contain the byte number and offset from the start of the byte.

getByteIndex

public int getByteIndex(int number)
Get the index in the sample for the given byte number.

Parameters:
number - The byte number.
Returns:
The position in the sample.

getByteValue

public int getByteValue(int byteNumber)
Get the byte value at the given byte number.

Parameters:
byteNumber - The index.
Returns:
The byte value, -1 for no value.

getBytes

public byte[] getBytes()
Get all the bytes.

Returns:
The byte values.

checkConsistent

public java.lang.String checkConsistent()
Checks whether the loaded bytes are consistent.

Returns:
null if consistent, otherwise error message.