Character streams in Java

I/O Streams

A Stream is a path of communication between the source and destination of data. A stream is linked to a physical device by the java I/O stream Java defined two types of streams: Byte streams and character streams.

Character Stream classes

Character stream handles input and output of streams.

Character stream are defined two class hierarchies: Reader and writer(abstract classes).

Character stream has two important methods:Read() and write().

Byte Stream classes

Byte streams handle input and output of bytes.

Byte streams are defined two class hierarchies:
InputStream and
OutputStream(abstract classes)

Each of these abstract classes has several subclasses.

Byte stream has two important methods: read() and write().

Byte Stream Classes

The most commonly used byte stream classes are: Input Stream and Output Stream classes. Input Stream classes are Buffered Input Stream, Byte Array Input Stream, Daa Input Stream, File Input Stream, Piped Input Sream, Object Input Stream, Sequence Input Stream, Push back Input Stream etc.

Output Stream classes are Buffer Output Stream, Byte Array Output Stream, Data Output Stream, File OutputStream, PipedOutputStream, ObjectOutputStream, PushOutputStream etc.

Example 1:

Example 2:

Output :

Exception in thread "main" access denied ("" "sorcefile.txt" "read")
  at java.lang.SecurityManager.checkPermission(
  at java.lang.SecurityManager.checkRead(
  at BStream.main(