Java PushbackReader Example

java-thumbnail

The PushbackReader is useful when you parse data from a Reader. Sometimes you would have the requirement to read ahead a few characters to see what is coming next, before you can determine how to interprete the current character. The PushbackReader allows that facility for the programmers. This class defines two constructors. PushbackReader(Reader in) – […]

Java BufferedWriter Example

java-thumbnail

BufferedWriter is useful in writing the sequence or stream of character to a file. The is fast compared to the FileOutputStream which is writing the stream of bytes. This class directly extends from the Writer class. It has two constructors. This class has the option to set the buffer size which is internally used by […]

Java StringReader Example

java-thumbnail

StringReader is extending from the Reader class. If you have string and wants to convert that to a Reader object, then StringReader is useful. It is a specialized version for using the Reader with strings. If you would like to read the Files, then choose FileReader instead of StringReader. This class has only one constructor […]

Java FileWriter Example

java-thumbnail

FileWriter class useful for writing the stream of characters to a file. FileWriter extends from the OutputStreamWriter. For writing streams of bytes, implement the FileOutputStream class. This class has the different constructors to create the instance for the file object. FileWriter(File file)- Constructs a FileWriter object given a File object. FileWriter(File file, boolean append) – […]

Java FileInputStream Example

java-thumbnail

FileInputStream is useful for reading the stream of bytes. If you want to read the characters, then consider using the FileReader. FileInputStream is ideal candidate for processing the image type of files which needed to be read as the binary streams. However, we can read the normal text files using the FileInputStream. This example demonstrates […]

Java LineNumberReader Example

java-thumbnail

In my previous example I have explained about the BufferedReader for reading the huge amount of data and parse it line by line. LineNumberReader is the specialized version of the BufferedReader where this class can store the line number in the file when it reads from the file. It is very useful when there is any […]

Java BufferedReader Example

java-thumbnail

In our previous example I have explained about the FileReader. FileReader is useful for reading the text content by characters. This is slow in performance when using for the huge files. BufferedReader is buffering the text for Reader’s. Buffering will speed up the IO operation. Instead of reading one character at a time using the […]

Java FileReader Example

java-thumbnail

Java has several File IO classes for reading and writing into the files. Each class has its own advantages. This example illustrates how to use FileReader for reading a text file. The main purpose of using the FileReader is to read the text content from a file where FileInputStream is used for reading the stream of […]

WeakReference in Java

java-thumbnail

WeakReference, SoftReference and PhantomReference are added to the Java API long back but have not effectively used by most of the programmers. The reason being the less knowledge on the concept of how these APIs work for managing the references. Basically these APIs are helping the Garbage Collector to claim the memory looking at the […]

Eclipse Tips : Refactoring History

eclipse-thumbnail

Rafactoring History is one of the rarely useful feature supported by Eclipse. If you are do lot of changes in the project, using this feature you could see the list of changes done on that project with the brief details about the changes. Note that this is not similar to the local history where local history […]

Close
Please support the site
By clicking any of these buttons you help our site to get better