# 通过代码在内存中进行打包(不落地)
代码实现
public void test2(){
String str = "你好!现在在测试通过inputstream生成压缩文件"; //文件的内容
InputStream input = new ByteArrayInputStream(str.getBytes()); // String 对inputStream的转换
// 在内存生成压缩文件
compressFileOnMemoryByInputStream(input);
}
public static void compressFileOnMemoryByInputStream(InputStream input) {
ZipOutputStream zipOS = null;
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] byteBuffer = new byte[<