Skip to content

Latest commit

 

History

History
30 lines (17 loc) · 1.29 KB

README.md

File metadata and controls

30 lines (17 loc) · 1.29 KB

important links

File Reader & File Writter

FileReader and FileWriter are character based, they are intended for reading and writing text.

FileInputStream & FileOutputStream

FileInputStream reads the contents of a file as a stream of bytes.

FileOutputStream writes the contents of a file as a stream of bytes.

 When you write to a FileOutputStream, the data may get cached internally in memory and 
 written to disk at a later time. If you want to make sure that all data is written to disk 
 without having to close the FileOutputStream, you can call its flush() method.

Buffered-Reader vs Buffered-InputStream

The difference is the same as between reader and inputstream: one is character-based, another is byte-based. For example: reader normally supports encoding,

  • BufferedInputStream reads the data in the buffer as bytes by using InputStream.
  • BufferedReader reads the text but not as bytes and BufferedReader is efficient reading of characters,arrays and lines.