org.apache.commons.io.input
Class CharSequenceReader
Reader
org.apache.commons.io.input.CharSequenceReader
- Serializable
public class CharSequenceReader
extends Reader
implements Serializable
Reader
implementation that can read from String, StringBuffer,
StringBuilder or CharBuffer.
Note: Supports
mark(int)
and
reset()
.
$Revision: 610516 $ $Date: 2008-01-09 19:05:05 +0000 (Wed, 09 Jan 2008) $
CharSequenceReader(CharSequence charSequence) - Construct a new instance with the specified character sequence.
|
void | close() - Close resets the file back to the start and removes any marked position.
|
void | mark(int readAheadLimit) - Mark the current position.
|
boolean | markSupported() - Mark is supported (returns true).
|
int | read() - Read a single character.
|
int | read(char[] array, int offset, int length) - Read the sepcified number of characters into the array.
|
void | reset() - Reset the reader to the last marked position (or the beginning if
mark has not been called).
|
long | skip(long n) - Skip the specified number of characters.
|
String | toString() - Return a String representation of the underlying
character sequence.
|
charSequence
private final CharSequence charSequence
CharSequenceReader
public CharSequenceReader(CharSequence charSequence)
Construct a new instance with the specified character sequence.
charSequence
- The character sequence, may be null
close
public void close()
Close resets the file back to the start and removes any marked position.
mark
public void mark(int readAheadLimit)
Mark the current position.
markSupported
public boolean markSupported()
Mark is supported (returns true).
read
public int read()
Read a single character.
- the next character from the character sequence
or -1 if the end has been reached.
read
public int read(char[] array,
int offset,
int length)
Read the sepcified number of characters into the array.
array
- The array to store the characters inoffset
- The starting position in the array to storelength
- The maximum number of characters to read
- The number of characters read or -1 if there are
no more
reset
public void reset()
Reset the reader to the last marked position (or the beginning if
mark has not been called).
skip
public long skip(long n)
Skip the specified number of characters.
n
- The number of characters to skip
- The actual number of characters skipped
toString
public String toString()
Return a String representation of the underlying
character sequence.
- The contents of the character sequence
Copyright (c) 2002-2008 Apache Software Foundation