fr.umlv.tatoo.runtime.buffer.impl
Class AbstractByteBufferCharacterBuffer

java.lang.Object
  extended by fr.umlv.tatoo.runtime.buffer.impl.AbstractByteBufferCharacterBuffer
All Implemented Interfaces:
CharacterBuffer
Direct Known Subclasses:
ByteBufferCharacterBuffer, CachedByteBufferCharacterBuffer

public abstract class AbstractByteBufferCharacterBuffer
extends Object
implements CharacterBuffer

ByteBufferCharacterBuffer.java Created: Mon Jul 14 14:16:09 2003

Version:
$Revision$
Author:
Gilles Roussel

Field Summary
protected  ByteBuffer buffer
           
protected  ByteChannel channel
           
protected  int position
           
protected  boolean previousWasNL
           
 
Constructor Summary
AbstractByteBufferCharacterBuffer(int size)
           
AbstractByteBufferCharacterBuffer(int size, ByteChannel channel)
           
 
Method Summary
 void clear()
           
 void compact()
           
abstract  CharSequence extractAndUnwind(int l)
           
 boolean hasRemaining()
           
 char next()
          Reads the next character from the buffer.
 int position()
           
 boolean previousWasNewLine()
          Determines if the last unwinded character was an end of line.
 int read()
           
 void setChannel(ByteChannel channel)
           
 void unwind(int l)
          Unwinds l characters from the buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

protected final ByteBuffer buffer

previousWasNL

protected boolean previousWasNL

channel

protected ByteChannel channel

position

protected int position
Constructor Detail

AbstractByteBufferCharacterBuffer

public AbstractByteBufferCharacterBuffer(int size,
                                         ByteChannel channel)

AbstractByteBufferCharacterBuffer

public AbstractByteBufferCharacterBuffer(int size)
Method Detail

setChannel

public void setChannel(ByteChannel channel)

extractAndUnwind

public abstract CharSequence extractAndUnwind(int l)

unwind

public void unwind(int l)
Description copied from interface: CharacterBuffer
Unwinds l characters from the buffer.

Specified by:
unwind in interface CharacterBuffer
Parameters:
l - the number of characters to unwind

previousWasNewLine

public boolean previousWasNewLine()
Description copied from interface: CharacterBuffer
Determines if the last unwinded character was an end of line.

Specified by:
previousWasNewLine in interface CharacterBuffer
Returns:
true if the last unwinded character was an end of line; false otherwise

hasRemaining

public boolean hasRemaining()

next

public char next()
Description copied from interface: CharacterBuffer
Reads the next character from the buffer. Current position in the buffer is incremented.

Specified by:
next in interface CharacterBuffer
Returns:
the next character in the buffer

compact

public void compact()

clear

public void clear()

position

public int position()

read

public int read()
         throws IOException
Throws:
IOException