Category: File Handling

Java Try With Resources 0

Java Try With Resources

Try with resources was one of the Java 7 features which was meant for automatic resource management. Resources are objects which must be closed once your program has used them. Before Java 7 we...

File change notification example with Watch Service API 0

File change notification example with Watch Service API

Java 7 adds a new feature for its NIO package called Watch Service API which allows applications monitoring directories and files for change events such as creation, deletion and modification. The Watch Service API...

Creating GIF image from normal images in Java 0

Creating GIF image from normal images in Java

I wanted to create a Facebook app in which user’s best 10 pics would be converted into a GIF image and uploaded to his profile. So after googling a lot I found some useful...

How to merge multiple files using SequenceInputStream 0

How to merge multiple files using SequenceInputStream

Imagine you have multiple source files whose data you need to merge into a single file. Using simple FileInputStream API this can be done. You will read each file sequentially and write it to...

Reading UTF-8 files – FileReader or FileInputStream? 0

Reading UTF-8 files – FileReader or FileInputStream?

FileReader and FileInputStream are two stream APIs for reading data from the files. FileReader is preferred when you are dealing with text files and want to read characters instead of bytes. A character can...