Java-PipedWriter and PipedReader

PipedWriter and PipedReader The PipedWriter class and PipedReader class provide functionality for threads to communicate and exchange data between them. The PipedWriter class lets a sending thread write a stream of characters to an instance of the PipedReader class, which a receiving thread uses to subsequently read those characters, as shown in following figure : PipedWriter declares a void connect(PipedReader … Read more…

Java-OutputStreamWriter and InputStreamReader

Java-OutputStreamWriter and InputStreamReader

OutputStreamWriter An OutputStreamWriter is a bridge from character streams to byte streams: Characters written to it are encoded into bytes using a specified charset. The charset that it uses may be specified by name or may be given explicitly, or the platform’s default charset may be accepted. Each invocation of a write() method causes the … Read more…

Java-StringReader

StringReader The StringReader class represents those character streams, whose source is a string. StringReader class extends the Reader class, which is an abstract class for reading data from character streams. StringReader Constructors Constructors Description StringReader(String s) Creates a new string reader. StringReader Methods Method Description int read() Reads a single character. int read(char[] cbuf, int off, int … Read more…

Java-StringWriter

StringWriter StringWriter class is a character stream that collects its output in a string buffer, which can then be used to construct a string. The buffer of StringWriter automatically grows according to data. Closing a StringWriter has no effect. StringWriter Constructors Constructor Description StringWriter() Create a new string writer using the default initial string-buffer size. StringWriter(int initialSize) … Read more…

Java-CharArrayReader

CharArrayReader CharArrayReader class contains an internal buffer that can be used as a character-input stream. It inherits Reader class. CharArrayReader Constructors Constructors Description CharArrayReader(char[] buf) Creates a CharArrayReader from a specified character array. CharArrayReader(char[] buf, int offset, int length) Creates a CharArrayReader from a specified part of character array. CharArrayReader Methods Method Description int read() Reads a … Read more…