package test; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; /** * @author shusheng * @description * @Email shusheng@yiji.com * @date 2018/11/9 16:16 */ public class FileInputStreamDemo2 { public static void main(String[] args) throws IOException { //封装数据源 FileInputStream fis = new FileInputStream("d:\aaa.zip"); //封装目的地 FileOutputStream fos = new FileOutputStream("e:\bbb.zip"); //读取数据 //定义一个字节数据 //数组的长度一般是1024或者1024的整数倍 byte[] by = new byte[1024]; int len = 0; while ((len = fis.read(by)) != -1) { fos.write(by); } } }