In my previous example, I have written a simple program to covert string object to InputStream. This tutorial does the reverse, converting inputstream into a string object. Lets look at the example.
In my previous article I have explained about how to create and write into a temporary file. Normally this file will be deleted once the operation is completed. Lets look at this simple example, to understand getting the temporary file path and deleting it on exit of the program. Delete Temporary File Example Output…
If you are working on the file operations, it is obvious that you have to use the temporary file concept for the file transfer activities. When you download or transfer a file from one location to another, a temporary file is created and then data transferred to the location. Once the entire data is transferred, […]
With the help of File IO API in Java, you can create a single directory or multiple directories in the disk. Here I wrote a very simple example to demonstrate the use of File class and create the directories. mkdir – Creates a directory mkdirs – Creates multiple directories Create Directory Example CreateDirectoryDemo.java
Marker Interfaces in Java are special interfaces which don’t declare any methods inside the interface definition. Because of that, if a class implements the marker interface don’t need to override any methods. What is the use of marker interface in Java?. It implicitly imposes a functionality or characteristic to the implementing class. There are many […]
In my previous tutorial I have explained about writing an object to a file using the serialization concept. Once you have written to a file, that file will be transferred across the network and would reach the destination. Once it is received, the receiver has to decode that file abd reading and converting back to […]
Java objects can be written to a file. If you implement Serializable interface to a class, implicitly that class is eligible for the serialization. Serializable is a marker interface which doesn’t have any methods defined. Serialization is the concept where an object can be converted to byte streams and transferred to the network. It is very much useful […]
This post demonstrates a simple example for how to compress your file and add to the ZIP file. Java has built-in API java.util.zip for compressing the files in ZIP format. It is very simple to read the files from your disk and writing to the destination ZIP file. It is straight forward. The steps involved […]