package com.itant.filetransfer;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class FileUtils {

	public static boolean copyFile(InputStream inputStream, OutputStream out) {
        byte buf[] = new byte[1024];
        int len;
        try {
            while ((len = inputStream.read(buf)) != -1) {
                out.write(buf, 0, len);
            }
            inputStream.close();
            
            // 一个文件结束了
            out.write("----".getBytes());
        } catch (IOException e) {
            return false;
        }
        return true;
    }
}
