This post explains PushBackReader class in java. This reader allows us to put the data read from the input stream back into the stream and reread it again. The below explains how to use it Main Class package IO; import java.io.PushbackReader; import java.io.StringReader; public class PushBackReaderDemo { public static void main(String[] args) throws Exception {…… Continue reading PushBackReader Demo
Category: IO
How to use SequenceInputStream
SequenceInputStream reads data from multiple inputstreams in an order. It starts with first inputstream and once it is done reading the first inputstream, it starts reading data from the next available inputstream. Two constructors are available for creating an instance of this stream. First one being SequenceInputStream(InputStream s1, InputStream s2) The above constructors limits us…… Continue reading How to use SequenceInputStream
LineNumberReader class setLineNumber method
As mentioned in Java API, LineNumberReader class keeps track of line number and return line number in addition to the data read. In this post I will mainly cover setLineNumber method in the class. The api document doesn’t clearly mention its purpose. The setLineNumber can be used for two purposes 1) Reset the line number…… Continue reading LineNumberReader class setLineNumber method