展开全部
字节流读取32313133353236313431303231363533e59b9ee7ad9431333337613830数据例子如下:import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* 复制文件
* @author young
*
*/
public class CopyFile {
public static void main(String[] args) {
/* 指定源exe文件的存放路径 */
String str = "f:/jdk-1_5_0_06-windows-i586-p.exe";
/* 指定复制后的exe的目标路径 */
String strs = "e:/copy.exe";
/* 创建输入和输出流 */
FileInputStream fis = null;
FileOutputStream fos = null;
try {
/* 将io流和文件关联 */
fis = new FileInputStream(str);
fos = new FileOutputStream(strs);
byte[] buf = new byte[1024 * 1024];
int len;
while ((len = fis.read(buf)) != -1) {
fos.write(buf, 0, len);
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
fis.close();
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}