| | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.io.*; |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.channels.FileChannel; |
| | | import java.nio.charset.StandardCharsets; |
| | |
| | | list.add(file); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 复制文件 |
| | | * |
| | | * @param src 源文件 |
| | | * @param dest 目录文件 |
| | | */ |
| | | public static void copyFile(File src, File dest) throws IOException { |
| | | InputStream is = null; |
| | | OutputStream os = null; |
| | | try { |
| | | is = new FileInputStream(src); |
| | | os = new FileOutputStream(dest); |
| | | |
| | | byte[] buffer = new byte[1024]; |
| | | |
| | | int length; |
| | | while ((length = is.read(buffer)) > 0) { |
| | | os.write(buffer, 0, length); |
| | | } |
| | | } finally { |
| | | os.close(); |
| | | is.close(); |
| | | } |
| | | } |
| | | } |