java网络编程____字节流操作(instream ,outstream)

package com.test.net.utils;

import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * @author Administrator
 * 字节流操作
 */
public class ByteStreamOper {
	public static void main(String[] args) throws Exception {
		fileInputStream();
	}
	public static void fileInputStream() throws Exception {
		FileInputStream fis = new FileInputStream("test.txt");
		FileOutputStream fos = new FileOutputStream("text.txt");
		int len = 0;
		byte[] bt = new byte[1024];
		while ((len = fis.read(bt)) != -1) {
			fos.write(bt, 0, len);
			System.out.println("写入成功内容为::___" + new String(bt, "UTF-8"));
		}
		fis.close();
		fos.close();
	}
}

//

posted @ 2017-03-09 14:44  蜜獾互联网  阅读(3)  评论(0编辑  收藏  举报  来源