Java Input/Output

Java FileWriter

Last Updated:

The Java FileWriter class is for writing the text to the character-based files using a default buffer size. It uses character encoding default to the …

Java InputStreamReader

Last Updated:

The Java InputStreamReader class is often used to read characters from files (or network connections) where the bytes represents text. In this Java tutorial, we …

Java StringReader

Java StringReader class represents a character stream whose source is a string. The main use of this class is to pass a String content to …

Java FileReader

Last Updated:

Java FileReader class can be used to read data (stream of characters) from files. In this tutorial, we will learn about FileReader class, its constructors, …

Java Read File from Classpath

Last Updated:

Learn to read a file from classpath in Java. The file can be present at the root of class path location or in any relative …

Java Append to File

Last Updated:

Learn to append content to file in Java using BufferedWritter, PrintWriter, FileOutputStream and Files class. In all the examples, while opening the file to write, …

Java – Write to File

Last Updated:

When working on enterprise application, sometimes it is needed to write files in java e.g. writing reports in filesystem.. Though, there are multiple ways to do so, let’s quickly go through few of them for quick reference when it is needed.

Java Read File to String

Last Updated:

Learn to read file content into string in java. Examples use Files.readAllBytes, Files.lines and FileReader & BufferedReader to read file content.

Java Convert OutputStream to InputStream Example

Last Updated:

In this java example, we will learn to convert OutputStream to InputStream which you may need when you read data from one source which return an outputstream; and write/pass the data to other target which wants data in inputstream.

Java Unzip File with Subdirectories

Last Updated:

Example of java code to unzip and extract files and sub-directories from a compressed zip file using java.util.zip package.

Java Get Current Working Directory Example

Last Updated:

Learn to use System.getProperty(“user.dir”) and Paths.get(“”).toAbsolutePath() to get current working directory or root folder of the application.

Java Read File

Last Updated:

In Java, a file can be read in many different ways. In this tutorial, we will learn some good ways to read a file in …

Java Create Password Protected Zip File

Last Updated:

This Java tutorial covers creating password-protected zip files using a very useful library zip4j. Java, by default, does not provide any support for password protection …

Java Copy Directory

Last Updated:

Learn to copy a directory into a new directory in Java. We will see the examples for copying only the directories, as well as, deep …

Java File Checksum – MD5 and SHA-256 Hash Example

Last Updated:

A checksum hash is an encrypted sequence of characters obtained after applying certain algorithms and manipulations on user-provided content. In this Java hashing tutorial, we …

Java – Make a File Read Only

Last Updated:

For making a file read-only in Java, we can use any one of the given below APIs. java.io.File.setReadOnly() java.io.File.setWritable(false) Runtime.getRuntime().exec() The Runtime.getRuntime().exec() is platform-specific because …

Java Copy File

Last Updated:

Copying a file from one place to another in Java is a common task which we need to do in the applications. In this Java …

Java FilenameFilter Example

Last Updated:

Many times we need to traverse and find all files with a certain name pattern to do some operations on those files, for example deleting …

HowToDoInJava

A blog about Java and its related technologies, the best practices, algorithms, interview questions, scripting languages, and Python.