Read/Write File In Java (

In Java, files can be processed by either streams or buffers. Library – helps in file processing by streams, where this is a classic one.
java.nio Library – helps in file processing by buffers, using nio(non blocking IO) is the latest one supported from Java 1.5

Streams are used to process files in package.
Byte Streams – FileInputStream/FileOutputStream, BufferedInputStream etc.,
Character Streams – FileReader/FileWriter etc.,

The following example provides an idea of how files can be read/write using byte streams.

Read File using FileInputStream in Java


Write content into File using FileOutpuStream


Leave a Reply

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