Java压缩类库的使用 2.JDK中的打包、压缩类库
inkfish原创,请勿商业性质转载,转载请注明来源(http://blog.csdn.net/inkfish)。
这里忽略了jar,因为jar实质上属于zip压缩。(来源:http://blog.csdn.net/inkfish)
JDK ZLIB压缩:(来源:http://blog.csdn.net/inkfish)
package study.inkfish.compress;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.InflaterInputStream;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
public class JdkZLIBCompress extends Compress {
@Override
protected void doCompress(File srcFile, File destFile) throws IOException {
OutputStream out = null;
InputStream is = null;
try {
is = new BufferedInputStream(new FileInputStream(srcFile), bufferLen);
out = new DeflaterOutputStream(new BufferedOutputStream(new FileOutputStream(destFile), bufferLen));
IOUtils.copy(is, out);
} finally {
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(out);
}
}
@Override
protected void doDecompress(File srcFile, File destDir) throws IOException {
InputStream is = null;
OutputStream os = null;
try {
File destFile = new File(destDir, FilenameUtils.getBaseName(srcFile.toString()));
is = new InflaterInputStream(new BufferedInputStream(new FileInputStream(srcFile), bufferLen));
os = new BufferedOutputStream(new FileOutputStream(destFile), bufferLen);
IOUtils.copy(is, os);
} finally {
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(os);
}
}
}
JDK ZIP压缩(仅适用于压缩一个文件):(来源:http://blog.csdn.net/inkfish)
package study.inkfish.compress;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOExcep
相关文档:
Java NIO API详解
在JDK
1.4以前,Java的IO操作集中在java.io这个包中,是基于流的阻塞(blocking)API。对于大多数应用来说,这样的API使用很方
便,然而,一些对性能要求较高的应用,尤其是服务端应用,往往需要一个更为有效的方式来处理IO。从JDK 1.4起,NIO
API作为一个基于缓冲区,并能提供非阻塞(non-blo ......
下载地址:
http://www.andykhan.com/jexcelapi/ 当前的最高版本是2.6。
真实下载地址:
http://www.andykhan.com/jexcelapi/download.html
作者的网站上对它的特征有如下描述:
● 支持Excel 95-2000的所有版本
● 生成Excel 2000标准格式
● 支持字体、数字 ......
1.因为两者的用途不同,所以Annotation与XML应该并存
Anootation vs XML 到了现在,在Spring和EJB3各占一边的持续演示下,各自的用途已清晰。
虽然两者之间完全可以相互替代,没有绝对不能做的事情,但却存在好不好的问题,两者的用途不同,应该并用:
"size=10, ......
一:J2SE 面向对象-封装、继承、多态
内存的分析
递归
集合类、泛型、自动打包与解包、Annotation
IO
多线程、线程同步
TCP/UDP
AWT、事件模型、匿名类
正则表达式
反射机制
2:数据库(Oracle或者MySQL)
SQL语句
多表连接,内外连接, 子查询等
管理表、视图、索引、序列、约束等
树状结构存储
存储过 ......
本项目用到的技术是ssh,ajax框架dwr,工作流等
遇到的问题是业务流程不熟悉,技术上和团队成员有些差距(但我相信自己会完成任务)
sql语句的编写
思路问题,只要有思路,就会有方法,做软件也需要奇思妙想啊哈哈;
开发过程也是不断学习的过程;
最近遇到了一个session和database不同步的问题,解决的方法是将 ......