摘 要
随着人们对数据的大量需求以及计算机使用时间的增加,计算机磁盘上的文件越来越大,越来越多。如何让有限的磁盘空间容纳更多的数据成为需要解决的问题。一方面,高速发展的存储技术以提高磁盘容量来解决这样的需求,但随着网络环境下数据传递的产生以及带宽的限制,大容量数据问题日益突出。在这两种需求的推动下,对数据压缩的需求产生了。人们可以将文件在不改变其本身的条件下,将其以更小的占用空间存储,并且在需要的时候将文件恢复成原有的样子,这就是压缩目的。本论文主要研究文件的无损压缩技术,并简要介绍了文件压缩的分类、几种常用的无损压缩格式和常用的压缩算法。运用LZ77字典算法、懒惰匹配算法和Huffman编码算法,使用Java语言在Jbuilder2006环境下设计了使用GZIP算法对文件压缩与解压缩的实现程序。用户可以根据自己的需求,使用此程序方便地对文件进行压缩或者解压缩操作。
关键词:压缩;解压缩;GZIP;Java
Abstract
As the great demand for data and the using time of computer are increasing, computer files on the disk grow more and more. How to make the limited disk space to store more data has became a problem crying out for solutions. On one hand, the rapid development of storage technology that can increase the disk capacity, can meet such demand. However, with the emergence of data transmission in a network environment and the bandwidth limitations, the problem of large-capacity data is increasingly prominent. With the promotion of both demands, the need for data compression and decompression is generated. People can store a file with a smaller storage space without changing the file’s own condition, and can restore the file; that is the purpose of data compression and decompression. This treatise principally research file lossless compression, otherwise, briefly introduced classification of file compression, some general lossless compression format and general compression algorithm. A procedure within algorithm called GZIP were designed for file compression and decompression in Java language under the circumstances of Jbuilder2006,which used LZ77 dictionary algorithm, lazy match algorithm and Huffman coding algorithm. Users could use this procedure compress or decompress files expediently according to their demand.
Key words: Compression; Decompression; GZIP; Java
目 录
论文总页数:21页
1 引言
1.1 课题背景
1.2 国内外现有的研究成果
2 压缩与解压缩程序分析
2.1 需求分析
2.2 使用的算法理论
2.2.1 LZ77算法简介
2.2.2 Huffman算法简介
2.2.3 GZIP算法原理分析
2.3 开发环境
3 总体设计
3.1 程序功能模块
3.2 模块分析与流程图
3.2.1 压缩模块
3.2.2 解压缩模块
3.3 程序中各个类的初步定义
4 详细设计和实现
4.1 压缩的程序流程
4.2 解压缩的程序流程
4.3 主函数代码
4.3.1 gzip压缩模块代码
4.3.2 ungzip解压缩模块代码
4.4 程序界面设计
5 软件系统测试
5.1 运行环境
5.2 测试方法
5.3 测试结果
5.3.1 使用程序对txt文件压缩
5.3.2 使用程序对bmp图象文件压缩
5.3.3 使用程序对doc文件压缩
结 论
参考文献
致 谢