Java IO

Java InputStream to String example

Java InputStream to String example shows how to convert InputStream to String in Java. Example also shows various ways to convert InputStream to...

Java create directory example

Java create directory example shows how to create directory in Java. Example also shows how to create directories including all parent directories.

Make file hidden in Java example

Make file hidden in Java example shows how to make file hidden in Java. Example also shows how to check if file is hidden or visible.

Make file read only Java example

Make file read only Java example shows how to make file read only in Java. Example also shows how to open, read and write read only file.

Get absolute file path in Java example

Get absolute file path example shows how to get absolute path of file in Java. Example also shows difference between path, absolute path and...

Get file size in Java example

Get file size in Java example shows how to get file size in Java. Example also shows how to get file size in bytes, KB, MB, GB and TB in Java.

Java String to InputStream example

Java String to InputStream example shows how to convert String to InputStream in Java. Example also shows how to set character encoding while...

Delete a file or directory in Java

This Java example shows how to delete a file or directory using Java. It also shows how to delete a directory recursively.
How to delete a file in...

Create a new empty File in Java Example

This example shows how to create a new empty file in Java either using createNewFile() method of File class or Apache Commons IO library.
How to...

Get extension of file in Java

This example shows various ways to extract file extension from the file name in Java.
How to get file extension in Java?
In most cases, file name...

Check if file exists in Java

Sometimes we want to check if file exists before opening it for reading. Java File class provides exists() method to check that.
How to check if file...

Join 1000+ fellow learners! Enter your email address below: