IO
来源:互联网 发布:棋牌源码论坛eenot 编辑:程序博客网 时间:2024/06/08 14:00
需要用try{} catch(Exception ex){ex.printStackTrace();} 包起来
write a serialized object to a file
FileOutputStream filestream = new FileOutputStream(file);
ObjectOutputStream os = new ObjectOutputStream(filestream);
os.writeObject(****);
0s.writeObject(****);(implements Serializable)(transient instance variables and static variables are not saved)
os.close();
restoring an object
FileInputStream filestream = new FileInputStream(file);
ObjectInputStream os = new ObjectInputStream(filestream);
Object o = os.readObject();(先进先出)
Object b = os.readObject();
转换类型
os.close();
write a string to a text file
FileWriter w = new FileWriter(file);
BufferedWriter writer = new BufferedWriter(w);
writer.write("*****");
writer.close();
reading from a text file
FileReader r = new FileReader(file);
BufferedReader reader = new BufferedReader(r);
String line = null;
while((line=reader.readline())!=null){
******
}
reader.close();
- IO
- IO
- io
- IO
- io
- IO
- io
- IO
- IO
- IO
- io
- IO
- IO
- IO
- IO
- IO
- IO
- IO
- Android之SurfaceView使用总结
- Linux read 用法
- 第十八章 TCP连接的建立和终止
- Eclipse启动时弹出“Failed to load the JNI shared library jvm.dll”错误的解决方法
- CSipSimple最新版本(二)--添加视频功能
- IO
- android 混淆手册
- 51音图 一个按键
- dos文件格式转换为Unix文件格式
- linux内存管理机制
- Ant工具使用之——基本功能介绍
- Eclipse中,check out 的项目下src是文件夹,不是标准java项目结构
- Python中子类怎样调用父类方法
- UVA - 536 Tree Recovery