Files and I/O (Cont.)
Getting File Information
Now that we have created a file, we can use other File
methods to get information about that file:
There are many available classes in the Java API that can be used to read and write files in Java.
Which one to use depends on the Java version you are working with and whether you need to read bytes or characters, and the size of the file/lines, etc.
Some of the file classes are given next:
FileReader
, which is used for reading streams of characters
BufferedReader
, which reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines
Files
, which is used for basic file operations like create, read, write, copy and delete the files or directories of the file system
Don’t cry over spilled milk.
|