Posts tagged "Java IO "

Tag Archives: Java IO

Make file Read Only in Java

To make file Read Only in Java, we use setReadOnly() method of the java.io.File package. Since JDK 1.6, a new setWritable() method is provided to make a file be writable again. We can also check whether the file is writable or read-only using the canWrite() method. We will see the whole process in the below-mentioned example. We will see, how … Continue reading Make file Read Only in Java

Get Last Modified Date of File in Java

Let’s see How can you get last modified date of File in Java. Sometimes we need to get the file last modified date in java usually, for listeners like JBoss config file changes hot deployment. To get the last modified date, you can use the File.lastModified() to get the file’s last modified timestamps. This method will return the … Continue reading Get Last Modified Date of File in Java

Read Data From Console in Java

In the tutorials we will see, How can we read data from the console in Java. There are many ways to read data from the keyboard. For example: InputStreamReader Console Scanner Java InputStreamReader class can be used to read data from the keyboard. It converts the byte-oriented stream into the character-oriented stream. We have already seen … Continue reading Read Data From Console in Java

Sequence InputStream in Java

Java SequenceInputStream class is used to read data from multiple streams or we can say SequenceInputStream is used to copy a number of source files to one destination file. Many input streams are concatenated and converted into a single stream and copied at a stretch to the destination file. SequenceInputStream contains two constructor – SequenceInputStream(file f1, … Continue reading Sequence InputStream in Java

Write and Read File in Java

This tutorial will explain how to write and read file in Java. The java.io package contains two classes, InputStream and OutputStream, from which most of the other classes in the package drive. In this tutorial, We will learn about these both two classes and see the use of these class. FileInputStream and FileOutputStream classes are used to read and … Continue reading Write and Read File in Java