Skip to content

Tag Archives: java-file-handling

The getFreeSpace() function is a part of File class in Java. This function returns the unallocated size of the partition denoted by the abstract pathname,… Read More
The createNewFile() function is a part of File class in Java . This function creates new empty file. The function returns true if the abstract… Read More
Prerequisite : PrintWriter, BufferedReader. We are given a directory/folder in which n number of files are stored(We dont know the number of files) and we want… Read More
Every 6 months, Oracle releases new Java versions. The September Java 11 version is already making a lot of buzz in the computer science world… Read More
In Java, we can append a string in an existing file using FileWriter which has an option to open a file in append mode. Java… Read More
In Java we can rename a file using renameTo(newName) method that belongs to the File class. Declaration: Following is the declaration for dest) method:… Read More
In Java we can use listRoots() of File class to find all root directories. import*;    public class GeeksforGeeks {     public static void main(String[]… Read More
To get the size of file from server first you need to connect to the server using URL and HttpURLConnection Class. To get the size… Read More
Given the input text file, read all mobile numbers present and write to some output file. Suppose we have a file names as input.txt and… Read More
Given a directory, print all files and folders present in directory tree rooted with given directory. We can iteratively traverse directory in BFS using below… Read More
Prerequisite : PrintWriter , BufferedReader Let the given two files be file1.txt and file2.txt. Our Task is to merge both files into third file say… Read More
Set 1, Set 2 More Methods of io.RandomAccessFile Class : write(int bytes) : bytes) writes specified byte to the file, starting from the current… Read More
Prerequisites: File class Given a main directory/folder, list all the files from it, and if this directory has other nested sub-directories, list files from them.… Read More
Prerequisite : PrintWriter , BufferedReader Given a file input.txt . Our Task is to remove duplicate lines from it and save the output in file… Read More
Prerequisite : PrintWriter , BufferedReader Given two files input.txt and delete.txt. Our Task is to perform file extraction(Input-Delete) and save the output in file say… Read More

Start Your Coding Journey Now!