文件的储存
来源:互联网 发布:个人发卡网源码授权 编辑:程序博客网 时间:2024/04/29 12:18
package hys;
import java.io.*;
public class hys {
static final String FileName="d:/student.txt";
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
String str;
InputStreamReader instr=new InputStreamReader(System.in);
BufferedReader bufred=new BufferedReader(instr);
OutputStreamWriter outstr=new OutputStreamWriter(System.out);
BufferedWriter bufwt=new BufferedWriter(outstr);
RandomAccessFile fisIn=new RandomAccessFile(FileName,"rw");
try {
System.out.print("请输入内容(按<Enter>键结束):\n");
str=bufred.readLine();
System.out.print("在路经"+FileName+"中存储内容...\n");
fisIn.writeBytes(str);
System.out.print("输出内容:\n");
bufwt.write(str);
bufwt.write((int)('\n'));
bufwt.flush();
}
catch(IOException ex) {
System.out.println("输入/输出异常!");
}
}
import java.io.*;
public class hys {
static final String FileName="d:/student.txt";
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
String str;
InputStreamReader instr=new InputStreamReader(System.in);
BufferedReader bufred=new BufferedReader(instr);
OutputStreamWriter outstr=new OutputStreamWriter(System.out);
BufferedWriter bufwt=new BufferedWriter(outstr);
RandomAccessFile fisIn=new RandomAccessFile(FileName,"rw");
try {
System.out.print("请输入内容(按<Enter>键结束):\n");
str=bufred.readLine();
System.out.print("在路经"+FileName+"中存储内容...\n");
fisIn.writeBytes(str);
System.out.print("输出内容:\n");
bufwt.write(str);
bufwt.write((int)('\n'));
bufwt.flush();
}
catch(IOException ex) {
System.out.println("输入/输出异常!");
}
}
}
阅读全文
1 0
- 图片文件的储存
- 文件的储存
- 文件的储存
- cifs文件的储存
- nfs文件的储存
- webgame的文件储存方案 .
- 文件储存
- 文件储存
- 实现 简单 的文件 储存--NSKeyedUnarchiver
- iOS 文件的三种储存方式
- Android数据储存——文件储存
- Android系统储存方式之文件储存
- ContentProvider 之文件储存
- FILE文件储存
- Android 文件储存
- 4.文件储存
- 文件储存forAndroid
- android文件储存
- 自定义provider服务
- Mybatis基本配置、日志文件(sql语句)打印
- 使用SpringMvc跨服务器上传图片,Ajax异步刷新图片框显示图片功能请求不到后台,onChange事件没有激活的源码?
- 160
- 简单模拟Build设计模式
- 文件的储存
- Myprovider服务
- angularJs常用服务
- 文件的复制
- Android的开发之&java23中设计模式------>代理模式
- 第九周项目二——二叉树遍历的递归算法
- HDU 1233 还是畅通工程 (并查集)
- LeetCode-Easy-Java-Count Binary Substrings
- arm汇编和neon汇编