package jp03.part0415.study;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
public class ReadObjectFile {
/**
* @param args
*/
int count = 0;
private ObjectInputStream ois;
public ReadObjectFile(){
try {
ois = new ObjectInputStream(new FileInputStream("MemberInfo.obj"));
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
public void ReadFile(){
MemberVO m1 = null;
MemberVO m2 = null;
try {
m1 = (MemberVO)ois.readObject();
m2 = (MemberVO)ois.readObject();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
} finally{
try {
ois.close();
} catch (IOException e) {
// TODO: handle exception
e.printStackTrace();
}
}
System.out.println("번호 : " + m1.getNo());
System.out.println("이름 : " + m1.getName());
System.out.println("번호 : " + m2.getNo());
System.out.println("이름 : " + m2.getName());
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new ReadObjectFile().ReadFile();
}
}
'프로그램 > Java & Jsp' 카테고리의 다른 글
[펌] - session 객체 (0) | 2008.12.29 |
---|---|
StringTokenizer (0) | 2008.08.20 |
Java IO - (8) -> [ObjectOutputStream] (0) | 2008.08.20 |
Java IO - (7) -> [FileWriter] (0) | 2008.08.20 |
Java IO - (6) -> [BufferedReader] (0) | 2008.08.20 |