Read a File

Python

Python Read File Line by Line (with Examples)

Python provides several ways to read a text file and process its lines sequentially or randomly. The correct method to use depends on the size of the file (large or small) and the ease of desired syntax. In this Python tutorial, we will discuss different approaches based on their clean syntaxes, ability to read large …

Reading a Large File Efficiently in Java

Learn to read all lines from a large file (size in GB) in Java and avoid any performance pitfalls such as very high usage of memory or even OutOfMemoryError if the File is large enough.

Java 11 Files.readString()

Learn to read a file to string in Java using Files.readString(path) method. This API has been introduced in Java 11.

Read File to Byte[] in Java

Learn reading data from files into a byte array in Java using NIO Files, FileInputStream, Commons IO FileUtils, and Guava ByteStreams classes.

Java Read a File Line by Line

In this Java tutorial, we will learn to read a text file line-by-line methods such as Streams or FileReader. We will also learn to iterate through lines and filter the file content based on some conditions. 1. Files.lines() – Stream through Lines of a File in Java 8 The Files.lines() …

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.