ewe.io
Interface DataProcessor

All Known Implementing Classes:
Base64Decoder, Base64Encoder, Encryptor, Encryptor

public interface DataProcessor


Method Summary
 void closeProcess()
          This aborts any on-going processing and frees resources associated with the processor.
 int getBlockSize()
          This returns the size of a block to be processed - any data blocks presented for processing must be multiples of this size.
 int getMaxBlockSize()
          This returns the largest block that can be processed.
 ByteArray processBlock(byte[] inputData, int offset, int length, boolean isLastBlock, ByteArray output)
          This processes a block of data and places the output in the provided ByteArray.
 

Method Detail

getBlockSize

public int getBlockSize()
This returns the size of a block to be processed - any data blocks presented for processing must be multiples of this size. If it is less than or equal to 1 it is assumed to be 1.


getMaxBlockSize

public int getMaxBlockSize()
This returns the largest block that can be processed. Any data blocks presented for processing must be a multiple of getBlockSize() and must be less than or equal to getMaxBlockSize(). If this returns less than or equal to zero then there is no maximum size.


processBlock

public ByteArray processBlock(byte[] inputData,
                              int offset,
                              int length,
                              boolean isLastBlock,
                              ByteArray output)
                       throws IOException
This processes a block of data and places the output in the provided ByteArray. If the ByteArray is null a new one will be created. The ByteArray will be expanded if necessary to hold the output data.

isLastBlock should be set true if this is the last set of data to be processed. If you want to end a processing run, but have no more data to provide - you can set length to be zero (you can then also set inputData to be null) and set isLastBlock true.

If isLastBlock is true the DataProcessor should accept any input data, complete processing and output ALL of any remaining processed data. It should then reset itself so that the next call of processBlock is considered to be the start of a new sequence of data.

If there is an error processing the data, an IOException should be thrown.

Throws:
IOException

closeProcess

public void closeProcess()
                  throws IOException
This aborts any on-going processing and frees resources associated with the processor. The processor should not be used again after this. An IOException should be thrown if there was an error closing the process.

Throws:
IOException