net.sf.mmm.util.io.api
Interface ByteProcessor

All Known Implementing Classes:
BufferInputStream.CopyProcessor, EncodingUtilImpl.AsciiProcessor, EncodingUtilImpl.UtfDetectionProcessor

public interface ByteProcessor

This is a call back interface that allows efficient processing of byte-buffers.

Since:
1.0.1
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Method Summary
 int process(byte[] buffer, int offset, int length)
          This method is called to process the number of length bytes from the given buffer starting from the given offset.
 

Method Detail

process

int process(byte[] buffer,
            int offset,
            int length)
This method is called to process the number of length bytes from the given buffer starting from the given offset.
ATTENTION:
An implementation of this interface should only read bytes from the given buffer. It is NOT permitted to modify the given buffer unless this is explicitly specified by the calling object (typically an implementation of ByteProcessable).

Parameters:
buffer - contains the bytes to process.
offset - is the index where to start in the buffer.
length - is the number of bytes to proceed.
Returns:
the number of bytes that should be consumed. Typically you will simply return length. However you can also return a value less than length and greater or equal to zero, in order to stop processing at a specific position.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.