2013년 2월 28일 목요일

[ Jsp ][ Java ] 객체 (클래스) 파일 읽기 쓰기



객체 쓰기

쓸객체는 implements Serializable를 해야한다
예) public class chkChargeList implements Serializable   {};

chkChargeList list = new chkChargeList();
FileOutputStream outFile = new FileOutputStream(filename);
ObjectOutputStream outStream = new ObjectOutputStream( outFile );
outStream.writeObject (list);


객체 읽기
FileInputStream inFile = new FileInputStream (filename);
ObjectInputStream inStream = new ObjectInputStream (inFile);
chkChargeList test = (chkChargeList) inStream.readObject();
system.out.println(test.getBasicCharge());

댓글 없음:

댓글 쓰기