net.sf.mmm.util.io.base
Class EncodingUtilImpl.AsciiProcessor

java.lang.Object
  extended by net.sf.mmm.util.io.base.EncodingUtilImpl.AsciiProcessor
All Implemented Interfaces:
ByteProcessor
Enclosing class:
EncodingUtilImpl

protected static class EncodingUtilImpl.AsciiProcessor
extends Object
implements ByteProcessor

This inner class is used to process the byes from the underlying InputStream in ASCII mode. It is used as long as no other encoding has been detected.


Field Summary
private  char[] charBuffer
          The character-buffer to fill by the reader.
private  int charOffset
          The current index in charBuffer.
 
Constructor Summary
EncodingUtilImpl.AsciiProcessor()
          The constructor.
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

charBuffer

private char[] charBuffer
The character-buffer to fill by the reader. Will be used in ASCII mode.


charOffset

private int charOffset
The current index in charBuffer.

Constructor Detail

EncodingUtilImpl.AsciiProcessor

public EncodingUtilImpl.AsciiProcessor()
The constructor.

Method Detail

process

public 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).

Specified by:
process in interface ByteProcessor
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.