Java IO at a Glance

Java IO at a Glance


Java I/O Streams – Overview

    File Copying

  1. Semantics of File copying – FileInputStream and FileOutputStream
  2. Skipping a few bytes in a file and reading
  3. File copying – Using FileReader & FileWriter
  4. Reading data types using DataInputStream and DataOutputStream
  5. Merging of files – SequenceInputStream
  6. Reading and writing sequentially and randomly – Using RandomAccessFile

Filter Streams1. FilterInputStream and FilterOutputStream 2. FilterReader and FilterWriter

Wrapper Streams: InputStreamReader and OutputStreamWriter

Keyboard Reading

  1. Using DataInputStream
  2. Using BufferedReader
  3. Scanner – No parsing

Reading and writing to arrays and strings

  1. Reading and writing into byte arrays: 1. ByteArrayInputStream 2.ByteArrayOutputStream
  2. Reading and writing to char arrays: 1. CharArrayReader 2. CharArrayWriter
  3. Reading strings using StringBufferInputStream: 1. StringReader 2. StringWriter

Special Programs

  1. To find number of lines in a file
  2. Adding line numbers to a file: 1. LineNumberInputStream 2. LineNumberReader
  3. PrintStream vs PrintWriter
  4. Byte streams vs Character streams
  5. Rereading a file – Using markSupported(), mark() & reset()
  6. Pushing out Character – PushbackReader
  7. Piping data between two streams – 1. PipedInputStream and PipedOutputStream 2. PipedReader and PipedWriter
  8. Retrieving metadata of a file – File class
  9. Changing file properties – File class
  10. Formatting Data – PrintWriter
  11. Chaining or linking of streams
  12. Closeable and Flushable interfaces
  13. PrintStream
  14. Tokenizing a stream – StreamTokenizer
  15. Checking for tokens in file reading – using Scanner
  16. What is System.out.println()?

Performance tips in file copying

  1. Performance drawbacks in file copying
  2. Peak performance with 1. BufferedInputStream and BufferedOutputStream 2. BufferedReader and BufferedWriter
  3. Performance in file copying using DataInputStream and DataOutputStream

Leave a Reply

Your email address will not be published. Required fields are marked *