请问如何在Java中把一个文件压缩成一个*.zip文件?? bbs.javaejb.com 上有例子,自己看吧 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public boolean zip( String entryname, byte[] data ) { boolean ret = false; if( ( entryname != null ) && ( data != null ) && ( data.length != 0 ) ) { try { File zipFile = new File( this.fullname ); ZipOutputStream zipoutStream = new ZipOutputStream( new FileOutputStream( zipFile ) ); ZipEntry target = new ZipEntry( entryname ); zipoutStream.putNextEntry( target ); zipoutStream.write( data ); zipoutStream.closeEntry(); zipoutStream.close(); ret = true; } catch( IOException e ) { System.out.println( "Zipper.zip( byte[] data ):" + e.getMessage() ); } } return ret; } 请问java的异步通信是个什么概念 Axis2 ,参数传递问题 tomcat服务启动结束后开启线程 谁解我愁? 请问如何判断用是在线还是离线?? java的中字符串的问题 两个hibernate应用中取数据不一致的疑问 java socket 编程! 新手初探,请大家看看!! weblogic启动后报错Root exception is javax.security.auth.login.FailedLoginException 请问在CMP中如何处理自动增长的主键? 急切!WEBLOGIC部署不能生成目录结构吗?我不想生成war文件。。。
boolean ret = false; if( ( entryname != null ) && ( data != null ) && ( data.length != 0 ) ) {
try {
File zipFile = new File( this.fullname );
ZipOutputStream zipoutStream = new ZipOutputStream( new FileOutputStream( zipFile ) );
ZipEntry target = new ZipEntry( entryname );
zipoutStream.putNextEntry( target );
zipoutStream.write( data );
zipoutStream.closeEntry();
zipoutStream.close();
ret = true;
} catch( IOException e ) {
System.out.println( "Zipper.zip( byte[] data ):" + e.getMessage() );
}
} return ret;
}