The IO classes

Subdecks (5)

Cards (36)

  • The Files class' newOutputStream() method is used to create a writable file.
  • A Path and a StandardOpenOption argument are passed to this method (newOutputStream[]). This method creates a file if it hasn't existed yet, opens the file for writing, and returns an OutputStream that can be used to write bytes to the file.
  • The newInputStream() method of the files class is used to open a file for reading. This method accepts a Path parameter and returns a stream that can read bytes from a file.
  • A BufferedReader object is declared to read a line of text from a character-input stream, buffering characters so reading is more efficient.
  • The BufferedWriter class writes text to an output stream, buffering the characters.