StringReader Class in Java

0
48
Spread the love
  • 28
  • 34
  • 24
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    133
    Shares

StringReader class in Java
StringReader class in Java

StringReader class in Java

StringReader class is a character input stream that uses a String object as the source of the characters it returns. When we create a StringReader, we must specify the String that it is to read from.

StringReader defines the Reader methods, and supports mark) and reset (). If reset () is called before mark () has been called, the stream is reset to the beginning of the specified string, StringReader is a character stream analog to StringBufferInputStream(deprecated now).

We can find similarities with CharArrayReader.

The class definition of StringReader is given as

public class java.io.StringReader extends java.io.Reader {
//Public Constructor
public StringReader(String s);
// Public Instance Methods
public void close();// Defines Reader
public void mark(int readAheadLimit) throws IOException;// Overrides Reader 
public boolean markSupported()// Overrides Reader
public int read() throws IOException;// Overrides Reader
public int read(char [ ] cbuf, int off, int len) throws IOException;//Defines Reader 
public boolean ready();// Overrides Reader
public void reset() throws IOException;// Overrides Reader
public long skip(long ns) throws IOException;// Overrides Reader
}
Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 28
  • 34
  • 24
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    133
    Shares

LEAVE A REPLY

Please enter your comment!
Please enter your name here