-
Notifications
You must be signed in to change notification settings - Fork 510
/
zlib.rbi
1323 lines (1173 loc) · 51.1 KB
/
zlib.rbi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# typed: __STDLIB_INTERNAL
# This module provides access to the [zlib library](http://zlib.net).
# [`Zlib`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html) is designed to be a
# portable, free, general-purpose, legally unencumbered -- that is, not covered
# by any patents -- lossless data-compression library for use on virtually any
# computer hardware and operating system.
#
# The zlib compression library provides in-memory compression and decompression
# functions, including integrity checks of the uncompressed data.
#
# The zlib compressed data format is described in RFC 1950, which is a wrapper
# around a deflate stream which is described in RFC 1951.
#
# The library also supports reading and writing files in gzip (.gz) format with
# an interface similar to that of
# [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html). The gzip format is
# described in RFC 1952 which is also a wrapper around a deflate stream.
#
# The zlib format was designed to be compact and fast for use in memory and on
# communications channels. The gzip format was designed for single-file
# compression on file systems, has a larger header than zlib to maintain
# directory information, and uses a different, slower check method than zlib.
#
# See your system's zlib.h for further information about zlib
#
# ## Sample usage
#
# Using the wrapper to compress strings with default parameters is quite simple:
#
# ```ruby
# require "zlib"
#
# data_to_compress = File.read("don_quixote.txt")
#
# puts "Input size: #{data_to_compress.size}"
# #=> Input size: 2347740
#
# data_compressed = Zlib::Deflate.deflate(data_to_compress)
#
# puts "Compressed size: #{data_compressed.size}"
# #=> Compressed size: 887238
#
# uncompressed_data = Zlib::Inflate.inflate(data_compressed)
#
# puts "Uncompressed data is: #{uncompressed_data}"
# #=> Uncompressed data is: The Project Gutenberg EBook of Don Quixote...
# ```
#
# ## [`Class`](https://docs.ruby-lang.org/en/2.7.0/Class.html) tree
#
# * [`Zlib::Deflate`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Deflate.html)
# * [`Zlib::Inflate`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Inflate.html)
# * [`Zlib::ZStream`](https://docs.ruby-lang.org/en/2.7.0/Zlib/ZStream.html)
# * [`Zlib::Error`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Error.html)
# * [`Zlib::StreamEnd`](https://docs.ruby-lang.org/en/2.7.0/Zlib/StreamEnd.html)
# * [`Zlib::NeedDict`](https://docs.ruby-lang.org/en/2.7.0/Zlib/NeedDict.html)
# * [`Zlib::DataError`](https://docs.ruby-lang.org/en/2.7.0/Zlib/DataError.html)
# * [`Zlib::StreamError`](https://docs.ruby-lang.org/en/2.7.0/Zlib/StreamError.html)
# * [`Zlib::MemError`](https://docs.ruby-lang.org/en/2.7.0/Zlib/MemError.html)
# * [`Zlib::BufError`](https://docs.ruby-lang.org/en/2.7.0/Zlib/BufError.html)
# * [`Zlib::VersionError`](https://docs.ruby-lang.org/en/2.7.0/Zlib/VersionError.html)
#
#
#
# (if you have GZIP\_SUPPORT)
# * [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# * [`Zlib::GzipWriter`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipWriter.html)
# * [`Zlib::GzipFile`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html)
# * [`Zlib::GzipFile::Error`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile/Error.html)
# * [`Zlib::GzipFile::LengthError`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile/LengthError.html)
# * [`Zlib::GzipFile::CRCError`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile/CRCError.html)
# * [`Zlib::GzipFile::NoFooter`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile/NoFooter.html)
module Zlib
# Represents text data as guessed by deflate.
#
# NOTE: The underlying constant Z\_ASCII was deprecated in favor of Z\_TEXT in
# zlib 1.2.2. New applications should not use this constant.
#
# See
# [`Zlib::Deflate#data_type`](https://docs.ruby-lang.org/en/2.7.0/Zlib/ZStream.html#method-i-data_type).
ASCII = T.let(T.unsafe(nil), Integer)
# Slowest compression level, but with the best space savings.
BEST_COMPRESSION = T.let(T.unsafe(nil), Integer)
# Fastest compression level, but with the lowest space savings.
BEST_SPEED = T.let(T.unsafe(nil), Integer)
# Represents binary data as guessed by deflate.
#
# See
# [`Zlib::Deflate#data_type`](https://docs.ruby-lang.org/en/2.7.0/Zlib/ZStream.html#method-i-data_type).
BINARY = T.let(T.unsafe(nil), Integer)
# Default compression level which is a good trade-off between space and time
DEFAULT_COMPRESSION = T.let(T.unsafe(nil), Integer)
# Default deflate strategy which is used for normal data.
DEFAULT_STRATEGY = T.let(T.unsafe(nil), Integer)
# The default memory level for allocating zlib deflate compression state.
DEF_MEM_LEVEL = T.let(T.unsafe(nil), Integer)
# Deflate strategy for data produced by a filter (or predictor). The effect of
# [`FILTERED`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#FILTERED) is to
# force more Huffman codes and less string matching; it is somewhat
# intermediate between
# [`DEFAULT_STRATEGY`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#DEFAULT_STRATEGY)
# and
# [`HUFFMAN_ONLY`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#HUFFMAN_ONLY).
# Filtered data consists mostly of small values with a somewhat random
# distribution.
FILTERED = T.let(T.unsafe(nil), Integer)
# Processes all pending input and flushes pending output.
FINISH = T.let(T.unsafe(nil), Integer)
# Deflate strategy which prevents the use of dynamic Huffman codes, allowing
# for a simpler decoder for specialized applications.
FIXED = T.let(T.unsafe(nil), Integer)
# Flushes all output as with
# [`SYNC_FLUSH`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#SYNC_FLUSH),
# and the compression state is reset so that decompression can restart from
# this point if previous compressed data has been damaged or if random access
# is desired. Like
# [`SYNC_FLUSH`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#SYNC_FLUSH),
# using
# [`FULL_FLUSH`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#FULL_FLUSH) too
# often can seriously degrade compression.
FULL_FLUSH = T.let(T.unsafe(nil), Integer)
# Deflate strategy which uses Huffman codes only (no string matching).
HUFFMAN_ONLY = T.let(T.unsafe(nil), Integer)
# The maximum memory level for allocating zlib deflate compression state.
MAX_MEM_LEVEL = T.let(T.unsafe(nil), Integer)
# The maximum size of the zlib history buffer. Note that zlib allows larger
# values to enable different inflate modes. See
# [`Zlib::Inflate.new`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Inflate.html#method-c-new)
# for details.
MAX_WBITS = T.let(T.unsafe(nil), Integer)
# No compression, passes through data untouched. Use this for appending
# pre-compressed data to a deflate stream.
NO_COMPRESSION = T.let(T.unsafe(nil), Integer)
# [`NO_FLUSH`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#NO_FLUSH) is the
# default flush method and allows deflate to decide how much data to
# accumulate before producing output in order to maximize compression.
NO_FLUSH = T.let(T.unsafe(nil), Integer)
# OS code for Amiga hosts
OS_AMIGA = T.let(T.unsafe(nil), Integer)
# OS code for Atari hosts
OS_ATARI = T.let(T.unsafe(nil), Integer)
# The OS code of current host
OS_CODE = T.let(T.unsafe(nil), Integer)
# OS code for CP/M hosts
OS_CPM = T.let(T.unsafe(nil), Integer)
# OS code for Mac OS hosts
OS_MACOS = T.let(T.unsafe(nil), Integer)
# OS code for MSDOS hosts
OS_MSDOS = T.let(T.unsafe(nil), Integer)
# OS code for OS2 hosts
OS_OS2 = T.let(T.unsafe(nil), Integer)
# OS code for QDOS hosts
OS_QDOS = T.let(T.unsafe(nil), Integer)
# OS code for RISC OS hosts
OS_RISCOS = T.let(T.unsafe(nil), Integer)
# OS code for TOPS-20 hosts
OS_TOPS20 = T.let(T.unsafe(nil), Integer)
# OS code for UNIX hosts
OS_UNIX = T.let(T.unsafe(nil), Integer)
# OS code for unknown hosts
OS_UNKNOWN = T.let(T.unsafe(nil), Integer)
# OS code for VM OS hosts
OS_VMCMS = T.let(T.unsafe(nil), Integer)
# OS code for VMS hosts
OS_VMS = T.let(T.unsafe(nil), Integer)
# OS code for Win32 hosts
OS_WIN32 = T.let(T.unsafe(nil), Integer)
# OS code for Z-System hosts
OS_ZSYSTEM = T.let(T.unsafe(nil), Integer)
# Deflate compression strategy designed to be almost as fast as
# [`HUFFMAN_ONLY`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#HUFFMAN_ONLY),
# but give better compression for PNG image data.
RLE = T.let(T.unsafe(nil), Integer)
# The [`SYNC_FLUSH`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#SYNC_FLUSH)
# method flushes all pending output to the output buffer and the output is
# aligned on a byte boundary. Flushing may degrade compression so it should be
# used only when necessary, such as at a request or response boundary for a
# network stream.
SYNC_FLUSH = T.let(T.unsafe(nil), Integer)
# Represents text data as guessed by deflate.
#
# See
# [`Zlib::Deflate#data_type`](https://docs.ruby-lang.org/en/2.7.0/Zlib/ZStream.html#method-i-data_type).
TEXT = T.let(T.unsafe(nil), Integer)
# Represents an unknown data type as guessed by deflate.
#
# See
# [`Zlib::Deflate#data_type`](https://docs.ruby-lang.org/en/2.7.0/Zlib/ZStream.html#method-i-data_type).
UNKNOWN = T.let(T.unsafe(nil), Integer)
# The Ruby/zlib version string.
VERSION = T.let(T.unsafe(nil), String)
# The string which represents the version of zlib.h
ZLIB_VERSION = T.let(T.unsafe(nil), String)
# Calculates Adler-32 checksum for `string`, and returns updated value of
# `adler`. If `string` is omitted, it returns the Adler-32 initial value. If
# `adler` is omitted, it assumes that the initial value is given to `adler`.
#
# Example usage:
#
# ```ruby
# require "zlib"
#
# data = "foo"
# puts "Adler32 checksum: #{Zlib.adler32(data).to_s(16)}"
# #=> Adler32 checksum: 2820145
# ```
def self.adler32(*_); end
# Combine two Adler-32 check values in to one. `alder1` is the first Adler-32
# value, `adler2` is the second Adler-32 value. `len2` is the length of the
# string used to generate `adler2`.
def self.adler32_combine(_, _, _); end
# Calculates CRC checksum for `string`, and returns updated value of `crc`. If
# `string` is omitted, it returns the CRC initial value. If `crc` is omitted,
# it assumes that the initial value is given to `crc`.
#
# FIXME: expression.
def self.crc32(*_); end
# Combine two CRC-32 check values in to one. `crc1` is the first CRC-32 value,
# `crc2` is the second CRC-32 value. `len2` is the length of the string used
# to generate `crc2`.
def self.crc32_combine(_, _, _); end
# Returns the table for calculating CRC checksum as an array.
def self.crc_table; end
# Compresses the given `string`. Valid values of level are
# [`Zlib::NO_COMPRESSION`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#NO_COMPRESSION),
# [`Zlib::BEST_SPEED`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#BEST_SPEED),
# [`Zlib::BEST_COMPRESSION`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#BEST_COMPRESSION),
# [`Zlib::DEFAULT_COMPRESSION`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#DEFAULT_COMPRESSION),
# or an integer from 0 to 9.
#
# This method is almost equivalent to the following code:
#
# ```ruby
# def deflate(string, level)
# z = Zlib::Deflate.new(level)
# dst = z.deflate(string, Zlib::FINISH)
# z.close
# dst
# end
# ```
#
# See also
# [`Zlib.inflate`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#method-c-inflate)
def self.deflate(*_); end
# Decode the given gzipped `string`.
#
# This method is almost equivalent to the following code:
#
# ```ruby
# def gunzip(string)
# sio = StringIO.new(string)
# gz = Zlib::GzipReader.new(sio, encoding: Encoding::ASCII_8BIT)
# gz.read
# ensure
# gz&.close
# end
# ```
#
# See also
# [`Zlib.gzip`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#method-c-gzip)
def self.gunzip(_); end
# Gzip the given `string`. Valid values of level are
# [`Zlib::NO_COMPRESSION`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#NO_COMPRESSION),
# [`Zlib::BEST_SPEED`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#BEST_SPEED),
# [`Zlib::BEST_COMPRESSION`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#BEST_COMPRESSION),
# [`Zlib::DEFAULT_COMPRESSION`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#DEFAULT_COMPRESSION)
# (default), or an integer from 0 to 9.
#
# This method is almost equivalent to the following code:
#
# ```ruby
# def gzip(string, level: nil, strategy: nil)
# sio = StringIO.new
# sio.binmode
# gz = Zlib::GzipWriter.new(sio, level, strategy)
# gz.write(string)
# gz.close
# sio.string
# end
# ```
#
# See also
# [`Zlib.gunzip`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#method-c-gunzip)
def self.gzip(*_); end
# Decompresses `string`. Raises a
# [`Zlib::NeedDict`](https://docs.ruby-lang.org/en/2.7.0/Zlib/NeedDict.html)
# exception if a preset dictionary is needed for decompression.
#
# This method is almost equivalent to the following code:
#
# ```ruby
# def inflate(string)
# zstream = Zlib::Inflate.new
# buf = zstream.inflate(string)
# zstream.finish
# zstream.close
# buf
# end
# ```
#
# See also
# [`Zlib.deflate`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#method-c-deflate)
def self.inflate(_); end
# Returns the string which represents the version of zlib library.
def self.zlib_version; end
end
# Subclass of
# [`Zlib::Error`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Error.html) when zlib
# returns a Z\_BUF\_ERROR.
#
# Usually if no progress is possible.
class Zlib::BufError < ::Zlib::Error; end
# Subclass of
# [`Zlib::Error`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Error.html) when zlib
# returns a Z\_DATA\_ERROR.
#
# Usually if a stream was prematurely freed.
class Zlib::DataError < ::Zlib::Error; end
# [`Zlib::Deflate`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Deflate.html) is
# the class for compressing data. See
# [`Zlib::ZStream`](https://docs.ruby-lang.org/en/2.7.0/Zlib/ZStream.html) for
# more information.
class Zlib::Deflate < ::Zlib::ZStream
# Creates a new deflate stream for compression. If a given argument is nil,
# the default value of that argument is used.
#
# The `level` sets the compression level for the deflate stream between 0 (no
# compression) and 9 (best compression). The following constants have been
# defined to make code more readable:
#
# * Zlib::DEFAULT\_COMPRESSION
# * Zlib::NO\_COMPRESSION
# * Zlib::BEST\_SPEED
# * Zlib::BEST\_COMPRESSION
#
#
# See http://www.zlib.net/manual.html#Constants for further information.
#
# The `window_bits` sets the size of the history buffer and should be between
# 8 and 15. Larger values of this parameter result in better compression at
# the expense of memory usage.
#
# The `mem_level` specifies how much memory should be allocated for the
# internal compression state. 1 uses minimum memory but is slow and reduces
# compression ratio while 9 uses maximum memory for optimal speed. The default
# value is 8. Two constants are defined:
#
# * Zlib::DEF\_MEM\_LEVEL
# * Zlib::MAX\_MEM\_LEVEL
#
#
# The `strategy` sets the deflate compression strategy. The following
# strategies are available:
#
# Zlib::DEFAULT\_STRATEGY
# : For normal data
# Zlib::FILTERED
# : For data produced by a filter or predictor
# Zlib::FIXED
# : Prevents dynamic Huffman codes
# Zlib::HUFFMAN\_ONLY
# : Prevents string matching
# Zlib::RLE
# : Designed for better compression of PNG image data
#
#
# See the constants for further description.
#
# ## Examples
#
# ### Basic
#
# ```ruby
# open "compressed.file", "w+" do |io|
# io << Zlib::Deflate.new.deflate(File.read("big.file"))
# end
# ```
#
# ### Custom compression
#
# ```ruby
# open "compressed.file", "w+" do |compressed_io|
# deflate = Zlib::Deflate.new(Zlib::BEST_COMPRESSION,
# Zlib::MAX_WBITS,
# Zlib::MAX_MEM_LEVEL,
# Zlib::HUFFMAN_ONLY)
#
# begin
# open "big.file" do |big_io|
# until big_io.eof? do
# compressed_io << zd.deflate(big_io.read(16384))
# end
# end
# ensure
# deflate.close
# end
# end
# ```
#
# While this example will work, for best optimization review the flags for
# your specific time, memory usage and output space requirements.
def self.new(*_); end
# Inputs `string` into the deflate stream just like
# [`Zlib::Deflate#deflate`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Deflate.html#method-i-deflate),
# but returns the
# [`Zlib::Deflate`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Deflate.html)
# object itself. The output from the stream is preserved in output buffer.
def <<(_); end
# Inputs `string` into the deflate stream and returns the output from the
# stream. On calling this method, both the input and the output buffers of the
# stream are flushed. If `string` is nil, this method finishes the stream,
# just like
# [`Zlib::ZStream#finish`](https://docs.ruby-lang.org/en/2.7.0/Zlib/ZStream.html#method-i-finish).
#
# If a block is given consecutive deflated chunks from the `string` are
# yielded to the block and `nil` is returned.
#
# The `flush` parameter specifies the flush mode. The following constants may
# be used:
#
# Zlib::NO\_FLUSH
# : The default
# Zlib::SYNC\_FLUSH
# : Flushes the output to a byte boundary
# Zlib::FULL\_FLUSH
# : SYNC\_FLUSH + resets the compression state
# Zlib::FINISH
# : Pending input is processed, pending output is flushed.
#
#
# See the constants for further description.
def deflate(*_); end
# This method is equivalent to `deflate('', flush)`. This method is just
# provided to improve the readability of your Ruby program. If a block is
# given chunks of deflate output are yielded to the block until the buffer is
# flushed.
#
# See
# [`Zlib::Deflate#deflate`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Deflate.html#method-i-deflate)
# for detail on the `flush` constants NO\_FLUSH, SYNC\_FLUSH, FULL\_FLUSH and
# FINISH.
def flush(*_); end
# Changes the parameters of the deflate stream to allow changes between
# different types of data that require different types of compression. Any
# unprocessed data is flushed before changing the params.
#
# See
# [`Zlib::Deflate.new`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Deflate.html#method-c-new)
# for a description of `level` and `strategy`.
def params(_, _); end
# Sets the preset dictionary and returns `string`. This method is available
# just only after
# [`Zlib::Deflate.new`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Deflate.html#method-c-new)
# or
# [`Zlib::ZStream#reset`](https://docs.ruby-lang.org/en/2.7.0/Zlib/ZStream.html#method-i-reset)
# method was called. See zlib.h for details.
#
# Can raise errors of Z\_STREAM\_ERROR if a parameter is invalid (such as NULL
# dictionary) or the stream state is inconsistent, Z\_DATA\_ERROR if the given
# dictionary doesn't match the expected one (incorrect adler32 value)
def set_dictionary(_); end
# Compresses the given `string`. Valid values of level are
# Zlib::NO\_COMPRESSION, Zlib::BEST\_SPEED, Zlib::BEST\_COMPRESSION,
# Zlib::DEFAULT\_COMPRESSION, or an integer from 0 to 9.
#
# This method is almost equivalent to the following code:
#
# ```ruby
# def deflate(string, level)
# z = Zlib::Deflate.new(level)
# dst = z.deflate(string, Zlib::FINISH)
# z.close
# dst
# end
# ```
#
# See also
# [`Zlib.inflate`](https://docs.ruby-lang.org/en/2.7.0/Zlib.html#method-c-inflate)
def self.deflate(*_); end
end
# The superclass for all exceptions raised by Ruby/zlib.
#
# The following exceptions are defined as subclasses of
# [`Zlib::Error`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Error.html). These
# exceptions are raised when zlib library functions return with an error status.
#
# * [`Zlib::StreamEnd`](https://docs.ruby-lang.org/en/2.7.0/Zlib/StreamEnd.html)
# * [`Zlib::NeedDict`](https://docs.ruby-lang.org/en/2.7.0/Zlib/NeedDict.html)
# * [`Zlib::DataError`](https://docs.ruby-lang.org/en/2.7.0/Zlib/DataError.html)
# * [`Zlib::StreamError`](https://docs.ruby-lang.org/en/2.7.0/Zlib/StreamError.html)
# * [`Zlib::MemError`](https://docs.ruby-lang.org/en/2.7.0/Zlib/MemError.html)
# * [`Zlib::BufError`](https://docs.ruby-lang.org/en/2.7.0/Zlib/BufError.html)
# * [`Zlib::VersionError`](https://docs.ruby-lang.org/en/2.7.0/Zlib/VersionError.html)
class Zlib::Error < ::StandardError; end
# [`Zlib::GzipFile`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html) is
# an abstract class for handling a gzip formatted compressed file. The
# operations are defined in the subclasses,
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# for reading, and
# [`Zlib::GzipWriter`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipWriter.html)
# for writing.
#
# GzipReader should be used by associating an
# [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html), or IO-like, object.
#
# ## [`Method`](https://docs.ruby-lang.org/en/2.7.0/Method.html) Catalogue
#
# * [`::wrap`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-c-wrap)
# * [`::open`](https://docs.ruby-lang.org/en/2.7.0/Kernel.html#method-c-open)
# ([`Zlib::GzipReader::open`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-c-open)
# and
# [`Zlib::GzipWriter::open`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipWriter.html#method-c-open))
# * [`close`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-close)
# * [`closed?`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-closed-3F)
# * [`comment`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-comment)
# * comment=
# ([`Zlib::GzipWriter#comment=`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipWriter.html#method-i-comment-3D))
# * [`crc`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-crc)
# * eof?
# ([`Zlib::GzipReader#eof?`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-eof-3F))
# * [`finish`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-finish)
# * [`level`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-level)
# * lineno
# ([`Zlib::GzipReader#lineno`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-lineno))
# * lineno=
# ([`Zlib::GzipReader#lineno=`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-lineno-3D))
# * [`mtime`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-mtime)
# * mtime=
# ([`Zlib::GzipWriter#mtime=`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipWriter.html#method-i-mtime-3D))
# * [`orig_name`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-orig_name)
# * [`orig_name`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-orig_name)
# ([`Zlib::GzipWriter#orig_name=`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipWriter.html#method-i-orig_name-3D))
# * [`os_code`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-os_code)
# * path (when the underlying
# [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html) supports path)
# * [`sync`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-sync)
# * [`sync=`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-sync-3D)
# * [`to_io`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-to_io)
#
#
# (due to internal structure, documentation may appear under
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# or
# [`Zlib::GzipWriter`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipWriter.html))
class Zlib::GzipFile
# Closes the
# [`GzipFile`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html) object.
# This method calls close method of the associated
# [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html) object. Returns the
# associated [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html) object.
def close; end
# Same as
# [`IO#closed?`](https://docs.ruby-lang.org/en/2.7.0/IO.html#method-i-closed-3F)
def closed?; end
# Returns comments recorded in the gzip file header, or nil if the comments is
# not present.
def comment; end
# Returns CRC value of the uncompressed data.
def crc; end
# Closes the
# [`GzipFile`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html) object.
# Unlike
# [`Zlib::GzipFile#close`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-close),
# this method never calls the close method of the associated
# [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html) object. Returns the
# associated [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html) object.
def finish; end
# Returns compression level.
def level; end
# Returns last modification time recorded in the gzip file header.
def mtime; end
# Returns original filename recorded in the gzip file header, or `nil` if
# original filename is not present.
def orig_name; end
# Returns OS code number recorded in the gzip file header.
def os_code; end
# Same as
# [`IO#sync`](https://docs.ruby-lang.org/en/2.7.0/IO.html#method-i-sync)
def sync; end
# Same as [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html). If flag is
# `true`, the associated [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html)
# object must respond to the `flush` method. While `sync` mode is `true`, the
# compression ratio decreases sharply.
def sync=(_); end
# Same as [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html).
def to_io; end
# Creates a GzipReader or GzipWriter associated with `io`, passing in any
# necessary extra options, and executes the block with the newly created
# object just like
# [`File.open`](https://docs.ruby-lang.org/en/2.7.0/File.html#method-c-open).
#
# The [`GzipFile`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html)
# object will be closed automatically after executing the block. If you want
# to keep the associated [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html)
# object open, you may call
# [`Zlib::GzipFile#finish`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-finish)
# method in the block.
def self.wrap(*_, &blk); end
end
# Raised when the CRC checksum recorded in gzip file footer is not equivalent to
# the CRC checksum of the actual uncompressed data.
class Zlib::GzipFile::CRCError < ::Zlib::GzipFile::Error; end
# Base class of errors that occur when processing GZIP files.
class Zlib::GzipFile::Error < ::Zlib::Error
# input gzipped string
def input; end
# Constructs a [`String`](https://docs.ruby-lang.org/en/2.7.0/String.html) of
# the GzipFile [`Error`](https://docs.ruby-lang.org/en/2.7.0/Error.html)
def inspect; end
end
# Raised when the data length recorded in the gzip file footer is not equivalent
# to the length of the actual uncompressed data.
class Zlib::GzipFile::LengthError < ::Zlib::GzipFile::Error; end
# Raised when gzip file footer is not found.
class Zlib::GzipFile::NoFooter < ::Zlib::GzipFile::Error; end
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# is the class for reading a gzipped file.
# [`GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# should be used as an [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html), or
# -IO-like, object.
#
# ```ruby
# Zlib::GzipReader.open('hoge.gz') {|gz|
# print gz.read
# }
#
# File.open('hoge.gz') do |f|
# gz = Zlib::GzipReader.new(f)
# print gz.read
# gz.close
# end
# ```
#
# ## [`Method`](https://docs.ruby-lang.org/en/2.7.0/Method.html) Catalogue
#
# The following methods in
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# are just like their counterparts in
# [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html), but they raise
# [`Zlib::Error`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Error.html) or
# [`Zlib::GzipFile::Error`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile/Error.html)
# exception if an error was found in the gzip file.
# * [`each`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-each)
# * [`each_line`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-each_line)
# * [`each_byte`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-each_byte)
# * [`gets`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-gets)
# * [`getc`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-getc)
# * [`lineno`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-lineno)
# * [`lineno=`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-lineno-3D)
# * [`read`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-read)
# * [`readchar`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-readchar)
# * [`readline`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-readline)
# * [`readlines`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-readlines)
# * [`ungetc`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-ungetc)
#
#
# Be careful of the footer of the gzip file. A gzip file has the checksum of
# pre-compressed data in its footer.
# [`GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# checks all uncompressed data against that checksum at the following cases, and
# if it fails, raises `Zlib::GzipFile::NoFooter`, `Zlib::GzipFile::CRCError`, or
# `Zlib::GzipFile::LengthError` exception.
#
# * When an reading request is received beyond the end of file (the end of
# compressed data). That is, when
# [`Zlib::GzipReader#read`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-read),
# [`Zlib::GzipReader#gets`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-gets),
# or some other methods for reading returns nil.
# * When
# [`Zlib::GzipFile#close`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-close)
# method is called after the object reaches the end of file.
# * When
# [`Zlib::GzipReader#unused`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-i-unused)
# method is called after the object reaches the end of file.
#
#
# The rest of the methods are adequately described in their own documentation.
class Zlib::GzipReader < ::Zlib::GzipFile
include(::Enumerable)
Elem = type_member(:out)
# Creates a
# [`GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# object associated with `io`. The
# [`GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# object reads gzipped data from `io`, and parses/decompresses it. The `io`
# must have a `read` method that behaves same as the
# [`IO#read`](https://docs.ruby-lang.org/en/2.7.0/IO.html#method-i-read).
#
# The `options` hash may be used to set the encoding of the data.
# `:external_encoding`, `:internal_encoding` and `:encoding` may be set as in
# [`IO::new`](https://docs.ruby-lang.org/en/2.7.0/IO.html#method-c-new).
#
# If the gzip file header is incorrect, raises an
# [`Zlib::GzipFile::Error`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile/Error.html)
# exception.
def self.new(*_); end
# This is a deprecated alias for `each_byte`.
def bytes; end
# See
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# documentation for a description.
def each(*_); end
# See
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# documentation for a description.
def each_byte; end
# See
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# documentation for a description.
def each_char; end
# See
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# documentation for a description.
def each_line(*_); end
# Returns `true` or `false` whether the stream has reached the end.
def eof; end
# Returns `true` or `false` whether the stream has reached the end.
def eof?; end
# See
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# documentation for a description.
def external_encoding; end
# See
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# documentation for a description.
def getbyte; end
# See
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# documentation for a description.
def getc; end
# See
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# documentation for a description.
def gets(*_); end
# The line number of the last row read from this file.
def lineno; end
# Specify line number of the last row read from this file.
def lineno=(_); end
# This is a deprecated alias for `each_line`.
def lines(*_); end
# Total number of output bytes output so far.
def pos; end
# See
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# documentation for a description.
def read(*_); end
# See
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# documentation for a description.
def readbyte; end
# See
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# documentation for a description.
def readchar; end
# See
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# documentation for a description.
def readline(*_); end
# See
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# documentation for a description.
def readlines(*_); end
# Reads at most *maxlen* bytes from the gziped stream but it blocks only if
# *gzipreader* has no data immediately available. If the optional *outbuf*
# argument is present, it must reference a
# [`String`](https://docs.ruby-lang.org/en/2.7.0/String.html), which will
# receive the data. It raises `EOFError` on end of file.
def readpartial(*_); end
# Resets the position of the file pointer to the point created the
# [`GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# object. The associated [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html)
# object needs to respond to the `seek` method.
def rewind; end
# Total number of output bytes output so far.
def tell; end
# See
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# documentation for a description.
def ungetbyte(_); end
# See
# [`Zlib::GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# documentation for a description.
def ungetc(_); end
# Returns the rest of the data which had read for parsing gzip format, or
# `nil` if the whole gzip file is not parsed yet.
def unused; end
# Opens a file specified by `filename` as a gzipped file, and returns a
# [`GzipReader`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html)
# object associated with that file. Further details of this method are in
# [`Zlib::GzipReader.new`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipReader.html#method-c-new)
# and ZLib::GzipFile.wrap.
def self.open(*_, &blk); end
end
# [`Zlib::GzipWriter`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipWriter.html)
# is a class for writing gzipped files.
# [`GzipWriter`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipWriter.html)
# should be used with an instance of
# [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html), or IO-like, object.
#
# Following two example generate the same result.
#
# ```ruby
# Zlib::GzipWriter.open('hoge.gz') do |gz|
# gz.write 'jugemu jugemu gokou no surikire...'
# end
#
# File.open('hoge.gz', 'w') do |f|
# gz = Zlib::GzipWriter.new(f)
# gz.write 'jugemu jugemu gokou no surikire...'
# gz.close
# end
# ```
#
# To make like gzip(1) does, run following:
#
# ```ruby
# orig = 'hoge.txt'
# Zlib::GzipWriter.open('hoge.gz') do |gz|
# gz.mtime = File.mtime(orig)
# gz.orig_name = orig
# gz.write IO.binread(orig)
# end
# ```
#
# NOTE: Due to the limitation of Ruby's finalizer, you must explicitly close
# [`GzipWriter`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipWriter.html)
# objects by
# [`Zlib::GzipWriter#close`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipFile.html#method-i-close)
# etc. Otherwise,
# [`GzipWriter`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipWriter.html) will
# be not able to write the gzip footer and will generate a broken gzip file.
class Zlib::GzipWriter < ::Zlib::GzipFile
# Creates a
# [`GzipWriter`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipWriter.html)
# object associated with `io`. `level` and `strategy` should be the same as
# the arguments of
# [`Zlib::Deflate.new`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Deflate.html#method-c-new).
# The [`GzipWriter`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipWriter.html)
# object writes gzipped data to `io`. `io` must respond to the `write` method
# that behaves the same as
# [`IO#write`](https://docs.ruby-lang.org/en/2.7.0/IO.html#method-i-write).
#
# The `options` hash may be used to set the encoding of the data.
# `:external_encoding`, `:internal_encoding` and `:encoding` may be set as in
# [`IO::new`](https://docs.ruby-lang.org/en/2.7.0/IO.html#method-c-new).
def self.new(*_); end
# Same as [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html).
def <<(_); end
# Specify the comment (`str`) in the gzip header.
def comment=(_); end
# Flushes all the internal buffers of the
# [`GzipWriter`](https://docs.ruby-lang.org/en/2.7.0/Zlib/GzipWriter.html)
# object. The meaning of `flush` is same as in
# [`Zlib::Deflate#deflate`](https://docs.ruby-lang.org/en/2.7.0/Zlib/Deflate.html#method-i-deflate).
# `Zlib::SYNC_FLUSH` is used if `flush` is omitted. It is no use giving flush
# `Zlib::NO_FLUSH`.
def flush(*_); end
# Specify the modification time (`mtime`) in the gzip header. Using an
# [`Integer`](https://docs.ruby-lang.org/en/2.7.0/Integer.html).
#
# Setting the mtime in the gzip header does not effect the mtime of the file
# generated. Different utilities that expand the gzipped files may use the
# mtime header. For example the gunzip utility can use the `-N' flag which
# will set the resultant file's mtime to the value in the header. By default
# many tools will set the mtime of the expanded file to the mtime of the
# gzipped file, not the mtime in the header.
#
# If you do not set an mtime, the default value will be the time when
# compression started. Setting a value of 0 indicates no time stamp is
# available.
def mtime=(_); end
# Specify the original name (`str`) in the gzip header.
def orig_name=(_); end
# Total number of input bytes read so far.
def pos; end
# Same as [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html).
def print(*_); end
# Same as [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html).
def printf(*_); end
# Same as [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html).
def putc(_); end
# Same as [`IO`](https://docs.ruby-lang.org/en/2.7.0/IO.html).
def puts(*_); end