Concept
When should you use specialized classes for binary file input?
ComputerScienceOne / File Input
"Using the Scanner class to do file input offers a more abstract interaction with a file. It also uses a buffered input stream for performance. Binary files can still be read using nextByte(). However, when dealing with binary files, the better solution is to use a class that models and abstracts the underlying file. For example, if you are reading or writing an image file, you should use the java.awt.Image class to read and write to files. The JDK and other libraries offer a wide variety of classes to model all kinds of data."
Related Ideas
- How can a Scanner read input from a file?ComputerScienceOne · File Input
- How can you write binary data to an output file?ComputerScienceOne · File Output
- How do buffered and unbuffered file input/output differ?ComputerScienceOne · Buffered and Unbuffered
- When should data be stored as binary or text files?ComputerScienceOne · Buffered and Unbuffered
- When should data be stored in binary or text file format?ComputerScienceOne · Binary vs Text Files
- How do fread and fwrite read and write binary data?ComputerScienceOne · Binary Files
- How do you write and read binary data in C?ComputerScienceOne · Closing Files
- How can you write formatted text to a file with PrintWriter?ComputerScienceOne · File Output