标签:exception oid ring buffere param tool cep odi 导入
导入
import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipOutputStream;
设置gbk 需放在第一行 找这个错找了半天
/**
* 压缩文件
* @param inputStream
* @param zipoutputStream
* @param fileName
* @throws IOException
*/
public static void zipFile(InputStream inputStream,ZipOutputStream zipoutputStream,String fileName) throws IOException {
zipoutputStream.setEncoding("gbk");
BufferedOutputStream bos = new BufferedOutputStream (zipoutputStream) ;
ZipEntry ze = new ZipEntry(fileName); //获取文件名
zipoutputStream.putNextEntry(ze); // 设置ZipEntry对象
byte [ ] b = new byte [ 100 ] ;
while ( true )
{
int len = inputStream.read ( b ) ;
if ( len == - 1 )
break ;
bos.write ( b , 0 , len ) ;
}
}
标签:exception oid ring buffere param tool cep odi 导入
原文地址:https://www.cnblogs.com/zcg1051980588/p/9529399.html