FILE IO - Java Codes

Replace a line or word in a file

Description To replace a word or words or complete line in an existing file with a new word or words or lines, the following programme helps to achieve it. Source Code import java.io.*; public class BT ...

0 Comments. 898 views since Oct 17, 2008

Java: Buffered Reader

Description This code demonstrates the "Buffer reader" in character and String. If you write a message that you want to stop if you write a specific alphabet or string. Source Code import java.io.*; p ...

0 Comments. 837 views since Sep 16, 2008

Check for Files

Description Get a list of files, and check if any files are missing. Source Code import java.io.*; import java.util.*; public class CheckFiles { public static void main(String[] argv) { Ch ...

0 Comments. 825 views since Sep 25, 2008

Print total number of lines in a file

Description Count the total number of files in a directory and print total number of lines in each file. Source Code import java.io.*; public class LineCount { static public void main(String ar ...

0 Comments. 708 views since Sep 25, 2008

Moving a File or Directory to Another Directory

Description Moving a File or Directory to Another Directory. Source Code import java.io.File; class Move{ public static void main(String args[]){ try{ // File (or directory) t ...

0 Comments. 659 views since Sep 25, 2008