public class StringReader

  1. Object
  2. Reader
  3. StringReader

ImplementsAutoCloseable

Constructors

public StringReader(String str)

Methods

public int read()Read a single character.
public int read(char[] cbuf, int off, int len)Read characters into a portion of an array.
public void close()Close the stream.
public String readLine()
public boolean ready()Tell whether this stream is ready to be read.

Inherited fields

Inherited methods

Constructor details

StringReader

public StringReader(String str)

Method details

read

public int read()
Read a single character. This method will block until a character is available, an I/O error occurs, or the end of the stream is reached. Subclasses that intend to support efficient single-character input should override this method.

read

public int read(char[] cbuf, int off, int len)
Read characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

close

public void close()
Close the stream. Once a stream has been closed, further read(), ready(), mark(), or reset() invocations will throw an IOException. Closing a previously-closed stream, however, has no effect.

readLine

public String readLine()

ready

public boolean ready()
Tell whether this stream is ready to be read.