Text and I/O

The part that leaves the program and reaches the disk: Scanner over standard input and the newline nextInt leaves, Files.readString and readAllLines, writing with Files.writeString and APPEND, and Path with resolve, relativize and Files.walk. Bytes and binary files come next, with ByteBuffer and a small binary record, then charsets and the mojibake a file written in UTF-8 and read in another charset gives. java.time and the formatters of dates and numbers per locale follow, with regular expressions and a log line parsed by groups, and the capstone reads, checks and writes a CSV file.

9.1 Scanner and standard input nextLine, nextInt, hasNext, the newline nextInt leaves, a menu loop Open 9.2 Reading files Files.readString, readAllLines, lines(), a missing file and its exception Open 9.3 Writing files Files.writeString, APPEND, createDirectories, a written file read back Open 9.4 Path and directories Path.of, resolve, relativize, normalize, Files.walk, a directory listing Open 9.5 Bytes and binary files Files.readAllBytes, write, ByteBuffer, a small binary record Open 9.6 Charsets and UTF-8 StandardCharsets, a file written in UTF-8 and read in another charset, the mojibake it gives Open 9.7 java.time LocalDate, LocalTime, Duration, Period, Instant, arithmetic across a month Open 9.8 Formatting dates and numbers DateTimeFormatter, NumberFormat, Locale, the same date in two locales Open 9.9 Regular expressions Pattern, Matcher, groups, replaceAll, a log line parsed Open 9.10 Capstone: a CSV file a reader with split, a quoted field, a writer, the round trip checked Open

Lessons