当前位置:网站首页>Source code analysis of GZIPInputStream class
Source code analysis of GZIPInputStream class
2022-07-31 09:48:00 【51CTO】
这是 《水煮 JDK 源码》系列 的第4篇文章,计划撰写100篇关于JDK源码相关的文章
GZIPInputStream
类位于 java.util.zip
包下,继承于 InflaterInputStream
类,It implements a streaming filter,主要用于读取GZIPCompressed data in file format,其UML类图如下:
类声明如下:
1、成员变量
GZIPInputStream
定义了3个成员变量,分别如下:
2、构造函数
创建 GZIPInputStream
There are two main ways to compress the input stream:
由于 GZIPInputStream
is due to reading the input stream of compressed data,Therefore a decompressor is required Inflater
.
3、读取数据方法
GZIPInputStream
主要提供了1A method for reading stream data,如下:
在读取数据之前,Need to first check if the stream is closed,if the stream has been closed,The description is unreadable,ensureOpen()
The method is for this purpose,其定义如下:
在创建 GZIPInputStream
when entering a stream,需要去读取 GZIP member header information,readHeader()
方法定义如下:
在读取数据的时候,需要读取GZIPtail information,And use this to judge whether the reading has ended,readTrailer()
方法如下:
No matter when reading header information or tail information,will read the specified length of the identification bit,比如 readUInt
、readUShort
、readUByte
方法,They are used to read unsigned integers, respectively、无符号短整型、Unsigned byte data,其定义如下:
4、其他方法
When reading compressed data streams,It is also possible to skip a specified number of bytes,其方法定义如下:
GZIPInputStream
的 close()
方法如下:
边栏推荐
猜你喜欢
随机推荐
js department budget and expenditure radar chart
UE4插件软链接(关联)
关于挂载EXfat文件格式U盘失败的问题
cocoaPods管理之后工程结构变化
P5231 [JSOI2012]玄武密码(SAM 经典运用)
Implement a thread pool
Open Kylin openKylin automation developer platform officially released
matlab 读取csv文件绘图
使用turtle画按钮
自定义v-drag指令(横向拖拽滚动)
多版本node的安装与切换详细操作
Come n times - 09. Implement queues with two stacks
各位大佬,sqlserver 支持表名正则匹配吗
Gradle系列——Groovy概述,基础使用(基于Groovy文档4.0.4)day2-1
踩水坑2 数据超出long long
loadrunner脚本--添加检查点
ecshop安装的时候提示不支持JPEG格式
【软考软件评测师】2012综合知识历年真题
Chapter Six
湖仓一体电商项目(二):项目使用技术及版本和基础环境准备