This is simple exmaple for converting string object to a InputStream and then read it using the BufferedReader.
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
This simple example shows how to get the standard input from console in Java. When you run this program, it asks the user for the input, if you enter a value, it is printed in the console. Let’s try this example. StdInputExample.java
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 […]