Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.3 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javolution.io
Class CharSequenceReader

    java.lang.Object
      java.io.Reader
          javolution.io.CharSequenceReader

All Implemented Interfaces:
  java.io.Closeable, java.lang.Readable, Reusable

    public final class CharSequenceReader

extends java.io.Reader
implements Reusable

This class allows any `CharSequence` to be used as a reader.

Version:
  3.8, May 8, 2004
Author:
  Jean-Marie Dautelle

Field Summary

Fields inherited from class java.io.Reader
`lock`

Constructor Summary
`CharSequenceReader()` Creates a new character sequence reader for which the character sequence input is not set.

Method Summary
`void` | `close()` Closes and `resets` this reader for reuse.
`int` | `read()` Reads a single character.
`void` | `read(java.lang.Appendable dest)` Reads characters into the specified appendable.
`int` | `read(char[] cbuf, int off, int len)` Reads characters into a portion of an array.
`boolean` | `ready()` Indicates if this stream is ready to be read.
`void` | `reset()` Resets the internal state of this object to its default values.
`CharSequenceReader` | `setInput(java.lang.CharSequence charSequence)` Sets the character sequence to use for reading.

Methods inherited from class java.io.Reader
`mark, markSupported, read, read, skip`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CharSequenceReader

    public CharSequenceReader()

  Creates a new character sequence reader for which the character sequence input is not set.

  See Also:
    `setInput(java.lang.CharSequence)`

Method Detail

### setInput

    public CharSequenceReader setInput(java.lang.CharSequence charSequence)

  Sets the character sequence to use for reading.

  Parameters:
    `charSequence` - the character sequence to be read.
  Returns:
    this reader.
  Throws:
    `java.lang.IllegalStateException` - if this reader is being reused and it has not been `closed` or `reset`.

### ready

    public boolean ready()
                  throws java.io.IOException

  Indicates if this stream is ready to be read.

  Overrides:
    `ready` in class `java.io.Reader`
  Returns:
    `true` if this reader has remaining characters to read; `false` otherwise.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### close

    public void close()

  Closes and `resets` this reader for reuse.

  Specified by:
    `close` in interface `java.io.Closeable`
  Specified by:
    `close` in class `java.io.Reader`

### read

    public int read()
             throws java.io.IOException

  Reads a single character. This method does not block, `-1` is returned if the end of the character sequence input has been reached.

  Overrides:
    `read` in class `java.io.Reader`
  Returns:
    the 31-bits Unicode of the character read, or -1 if there is no more remaining bytes to be read.
  Throws:
    `java.io.IOException` - if an I/O error occurs (e.g. incomplete character sequence being read).

### read

    public int read(char[] cbuf,
                    int off,
                    int len)
             throws java.io.IOException

  Reads characters into a portion of an array. This method does not block.

  Specified by:
    `read` in class `java.io.Reader`
  Parameters:
    `cbuf` - the destination buffer.
    `off` - the offset at which to start storing characters.
    `len` - the maximum number of characters to read
  Returns:
    the number of characters read, or -1 if there is no more character to be read.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### read

    public void read(java.lang.Appendable dest)
              throws java.io.IOException

  Reads characters into the specified appendable. This method does not block.

  Parameters:
    `dest` - the destination buffer.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### reset

    public void reset()

  Description copied from interface: `Reusable`
  Resets the internal state of this object to its default values.

  Specified by:
    `reset` in interface `Reusable`
  Overrides:
    `reset` in class `java.io.Reader`

Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.3 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005 - 2009 Javolution.