import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
public class MainClass {
public static void main(String[] argv)throws Exception {
StringBuilder writeMe = new StringBuilder();
FileOutputStream fos = new FileOutputStream("sbuf.ser");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(writeMe);
oos.close();
fos.close();
FileInputStream fis = new FileInputStream("sbuf.ser");
ObjectInputStream ois = new ObjectInputStream(fis);
StringBuffer sb = (StringBuffer) ois.readObject();
ois.close();
fis.close();
}
}
|