Bifalgorithm post · Computer science one · File Input

When should you use specialized classes for binary file input?

When should you use specialized classes for binary file input? (Computer science one · File Input) — "Using the Scanner class to do file input offers a more ab…

Ideas in this flowchart

  • Using the Scanner class for file input
  • Scanner provides a more abstract interaction with a file.
  • Scanner uses a buffered input stream for better performance.
  • Binary files can still be read with nextByte().
  • For binary files, it is better to use a class that models and abstracts the underlying file.
  • The java.awt.Image class can read and write image files.
  • The JDK and other libraries provide classes for modeling many kinds of data.
Feed/

When should you use specialized classes for binary file input?

No cover

Channel

Computer science one

1 page

"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."

Flowchart preview
👍
0
0 comments0 shares

Sign in to view and post comments.