当前位置:网站首页>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 radar chart statistical chart plugin
Kotlin—基本语法(一)
Open Kylin openKylin automation developer platform officially released
[ verb phrase ] collection
【Redis高手修炼之路】Jedis——Jedis的基本使用
loadrunner脚本--添加检查点
Flink1.15 source code reading - PER_JOB vs APPLICATION execution process
业务-(课程-章节-小节)+课程发布一些业务思路
湖仓一体电商项目(二):项目使用技术及版本和基础环境准备
5.for in 和 for of区别和使用
Come n times with the sword--05. Replace spaces
如何将虚拟机上的文件复制到主机上
MySQL (2)
【RISC-V】risc-v架构学习笔记(架构初学)
第五章
js部门预算和支出雷达图
Add a shuffling effect to every pie
NowCoderTOP17-22 二分查找/排序——持续更新ing
loadrunner-controller-目标场景Schedule配置
自定义v-drag指令(横向拖拽滚动)