IO
来源:互联网 发布:日本股票行情查看软件 编辑:程序博客网 时间:2024/06/06 00:21
/* * FileInputStream 用于读取诸如图像数据之类的原始字节流。要读取字符流,请考虑使用 FileReader * FileInputStream 两种常用的构造法1.指定文件的路径名2指定文件 File * 只有 read 一种读取方法 * * 示例: 读取图片 */import java.io.* ; public class FileStreamTest{ public static void main(String[] args) throws Exception { //FileInputStream fin = new FileInputStream("C:\\Users\\jiaoda\\Desktop\\1.jpg"); // FileOutputStream fos =new FileOutputStream("D:\\copy_1.jpg"); FileInputStream fin = new FileInputStream("C:\\Users\\jiaoda\\Desktop\\1.txt"); FileOutputStream fos =new FileOutputStream("D:\\copy_1.txt"); byte [] buf = new byte[fin.available()]; fin.read(buf); fos.write(buf); /* byte [] buf = new byte[1024]; while(fin.read(buf)!=-1) { System.out.println(new String(buf, 0,buf.length)); } */ fin.close(); fos.close(); }}
0 0
- IO
- IO
- io
- IO
- io
- IO
- io
- IO
- IO
- IO
- io
- IO
- IO
- IO
- IO
- IO
- IO
- IO
- Java 中栈内存和堆内存的区别
- Android与服务器端数据交互(http协议整合struts2+android)
- 内存分配中的“堆栈”与数据结构中的“堆栈”
- Codeforces Round #271 (Div. 2) C
- acdream 1430 SETI 后缀数组+height分组
- IO
- itext html to pdf
- Sicily1193
- linux 跌跌碰碰的研究中
- Linux文件系统(七)---系统调用之open操作(一)
- LeetCode - Sort List
- atoi(c++实现)
- Huffman编码原理详解
- 电子管晶体管集成电路简要介绍