本帖最后由 心弦上的景致 于 2013-4-10 12:23 编辑
- import java.io.*;
- public class Inttt {
- public static void main(String[] args) {
- String name1="F:\\我的文档\\123.jpg";
- String name2="F:\\我的文档\\555.jpg";
- try {
- BufferedInputStream in = new BufferedInputStream(
- new FileInputStream(name1));
- BufferedOutputStream out = new BufferedOutputStream(
- new FileOutputStream(name2));
- int buffer = 8192;
- byte[] bt = new byte[buffer];
- int read;
- if (in != null) {
- while (true) {
- if ((read = in.read(bt,0,bt.length)) != -1) {
- out.write(bt,0,read);
- }else{
- break;
- }
- }
- }
- in.close();
- } catch (Exception e) {
- }
- }
- }
复制代码 |