1
2
3
4
Refer: ConsoleIOExample.java
5
6
InputStream is an abstract base class for reading bytes. OuputStream is an abstract blasĂŠ class for writing bytes.
7
8
9
10
11
12
13
14
15
InputStream can read byte-by-byte. InputStreamReader is a bridging class which converts byte stream to character stream. BufferedReader can be used to read line-by-line.
16
Refer: http://www.oodesign.com/decorator-pattern.html.
17
18
19
20
21
File Serialization - Take any object that implements the Serialization interface, convert it into bytes and store it into file; The file can be fully restore back to the original object later. Refer - http://www.mkyong.com/java/how-to-write-an-object-to-file-in-java/ Refer - http://www.mkyong.com/java/how-to-read-an-object-from-file-in-java/
22
23
24
1 ) The object is read from the stream 2) JVM loads the class of Object. 3) A new Object is given space in heap area, Constructors are not called. 4) The object's instance variables are given the values from the serialized state
25
26
.
27
3: Java uses Call-by-reference semantics when objects are passed as argument to methods. In distributed computing each JVM is in a different address space, hence call-byreference does not work. We need serialization to replicate the Object into another JVM.
28
29
30
31
The Java platform stores character values using Unicode conventions. Character stream I/O automatically translates this internal format to and from the local character set. All character stream classes are descended from Reader and Writer.
32
Refer Character Streams. URL: http://goo.gl/D5q11
33
34
35
36
37
38
39
40
41
42