rbs 3.1.3 → 3.2.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +0 -6
  3. data/CHANGELOG.md +68 -0
  4. data/Gemfile +0 -6
  5. data/Gemfile.lock +12 -21
  6. data/README.md +1 -1
  7. data/Rakefile +44 -0
  8. data/Steepfile +3 -3
  9. data/core/array.rbs +0 -8
  10. data/core/builtin.rbs +28 -8
  11. data/core/constants.rbs +13 -5
  12. data/core/exception.rbs +1 -1
  13. data/core/global_variables.rbs +27 -27
  14. data/core/io.rbs +163 -172
  15. data/core/kernel.rbs +7 -4
  16. data/core/module.rbs +34 -32
  17. data/core/object.rbs +2 -2
  18. data/core/string_io.rbs +9 -0
  19. data/core/thread.rbs +25 -1
  20. data/core/time.rbs +3 -3
  21. data/docs/CONTRIBUTING.md +1 -1
  22. data/docs/rbs_by_example.md +16 -35
  23. data/docs/repo.md +1 -1
  24. data/docs/sigs.md +7 -7
  25. data/docs/stdlib.md +2 -3
  26. data/docs/syntax.md +40 -40
  27. data/lib/rbs/cli.rb +15 -4
  28. data/lib/rbs/collection/installer.rb +5 -2
  29. data/lib/rbs/collection/sources/stdlib.rb +5 -1
  30. data/lib/rbs/errors.rb +8 -1
  31. data/lib/rbs/file_finder.rb +1 -1
  32. data/lib/rbs/prototype/rb.rb +64 -6
  33. data/lib/rbs/prototype/rbi.rb +2 -6
  34. data/lib/rbs/prototype/runtime.rb +29 -8
  35. data/lib/rbs/subtractor.rb +17 -0
  36. data/lib/rbs/type_name.rb +4 -4
  37. data/lib/rbs/version.rb +1 -1
  38. data/rbs.gemspec +1 -1
  39. data/schema/decls.json +1 -1
  40. data/sig/errors.rbs +54 -0
  41. data/sig/parser.rbs +2 -2
  42. data/sig/prototype/rb.rbs +9 -1
  43. data/sig/subtractor.rbs +4 -0
  44. data/stdlib/logger/0/logger.rbs +1 -1
  45. data/stdlib/observable/0/observable.rbs +219 -0
  46. data/stdlib/uri/0/common.rbs +24 -0
  47. data/stdlib/zlib/0/buf_error.rbs +79 -0
  48. data/stdlib/zlib/0/data_error.rbs +79 -0
  49. data/stdlib/zlib/0/deflate.rbs +276 -0
  50. data/stdlib/zlib/0/error.rbs +89 -0
  51. data/stdlib/zlib/0/gzip_file/crc_error.rbs +115 -0
  52. data/stdlib/zlib/0/gzip_file/error.rbs +128 -0
  53. data/stdlib/zlib/0/gzip_file/length_error.rbs +115 -0
  54. data/stdlib/zlib/0/gzip_file/no_footer.rbs +114 -0
  55. data/stdlib/zlib/0/gzip_file.rbs +228 -0
  56. data/stdlib/zlib/0/gzip_reader.rbs +362 -0
  57. data/stdlib/zlib/0/gzip_writer.rbs +237 -0
  58. data/stdlib/zlib/0/inflate.rbs +249 -0
  59. data/stdlib/zlib/0/mem_error.rbs +79 -0
  60. data/stdlib/zlib/0/need_dict.rbs +82 -0
  61. data/stdlib/zlib/0/stream_end.rbs +80 -0
  62. data/stdlib/zlib/0/stream_error.rbs +80 -0
  63. data/stdlib/zlib/0/version_error.rbs +80 -0
  64. data/stdlib/zlib/0/zstream.rbs +270 -0
  65. metadata +24 -8
  66. data/stdlib/prime/0/integer-extension.rbs +0 -41
  67. data/stdlib/prime/0/manifest.yaml +0 -2
  68. data/stdlib/prime/0/prime.rbs +0 -372
@@ -0,0 +1,79 @@
1
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
2
+ # This module provides access to the [zlib library](http://zlib.net). Zlib is
3
+ # designed to be a portable, free, general-purpose, legally unencumbered -- that
4
+ # is, not covered by any patents -- lossless data-compression library for use on
5
+ # virtually any computer hardware and operating system.
6
+ #
7
+ # The zlib compression library provides in-memory compression and decompression
8
+ # functions, including integrity checks of the uncompressed data.
9
+ #
10
+ # The zlib compressed data format is described in RFC 1950, which is a wrapper
11
+ # around a deflate stream which is described in RFC 1951.
12
+ #
13
+ # The library also supports reading and writing files in gzip (.gz) format with
14
+ # an interface similar to that of IO. The gzip format is described in RFC 1952
15
+ # which is also a wrapper around a deflate stream.
16
+ #
17
+ # The zlib format was designed to be compact and fast for use in memory and on
18
+ # communications channels. The gzip format was designed for single-file
19
+ # compression on file systems, has a larger header than zlib to maintain
20
+ # directory information, and uses a different, slower check method than zlib.
21
+ #
22
+ # See your system's zlib.h for further information about zlib
23
+ #
24
+ # ## Sample usage
25
+ #
26
+ # Using the wrapper to compress strings with default parameters is quite simple:
27
+ #
28
+ # require "zlib"
29
+ #
30
+ # data_to_compress = File.read("don_quixote.txt")
31
+ #
32
+ # puts "Input size: #{data_to_compress.size}"
33
+ # #=> Input size: 2347740
34
+ #
35
+ # data_compressed = Zlib::Deflate.deflate(data_to_compress)
36
+ #
37
+ # puts "Compressed size: #{data_compressed.size}"
38
+ # #=> Compressed size: 887238
39
+ #
40
+ # uncompressed_data = Zlib::Inflate.inflate(data_compressed)
41
+ #
42
+ # puts "Uncompressed data is: #{uncompressed_data}"
43
+ # #=> Uncompressed data is: The Project Gutenberg EBook of Don Quixote...
44
+ #
45
+ # ## Class tree
46
+ #
47
+ # * Zlib::Deflate
48
+ # * Zlib::Inflate
49
+ # * Zlib::ZStream
50
+ # * Zlib::Error
51
+ # * Zlib::StreamEnd
52
+ # * Zlib::NeedDict
53
+ # * Zlib::DataError
54
+ # * Zlib::StreamError
55
+ # * Zlib::MemError
56
+ # * Zlib::BufError
57
+ # * Zlib::VersionError
58
+ # * Zlib::InProgressError
59
+ #
60
+ #
61
+ #
62
+ # (if you have GZIP_SUPPORT)
63
+ # * Zlib::GzipReader
64
+ # * Zlib::GzipWriter
65
+ # * Zlib::GzipFile
66
+ # * Zlib::GzipFile::Error
67
+ # * Zlib::GzipFile::LengthError
68
+ # * Zlib::GzipFile::CRCError
69
+ # * Zlib::GzipFile::NoFooter
70
+ #
71
+ module Zlib
72
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
73
+ # Subclass of Zlib::Error when zlib returns a Z_BUF_ERROR.
74
+ #
75
+ # Usually if no progress is possible.
76
+ #
77
+ class BufError < Zlib::Error
78
+ end
79
+ end
@@ -0,0 +1,79 @@
1
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
2
+ # This module provides access to the [zlib library](http://zlib.net). Zlib is
3
+ # designed to be a portable, free, general-purpose, legally unencumbered -- that
4
+ # is, not covered by any patents -- lossless data-compression library for use on
5
+ # virtually any computer hardware and operating system.
6
+ #
7
+ # The zlib compression library provides in-memory compression and decompression
8
+ # functions, including integrity checks of the uncompressed data.
9
+ #
10
+ # The zlib compressed data format is described in RFC 1950, which is a wrapper
11
+ # around a deflate stream which is described in RFC 1951.
12
+ #
13
+ # The library also supports reading and writing files in gzip (.gz) format with
14
+ # an interface similar to that of IO. The gzip format is described in RFC 1952
15
+ # which is also a wrapper around a deflate stream.
16
+ #
17
+ # The zlib format was designed to be compact and fast for use in memory and on
18
+ # communications channels. The gzip format was designed for single-file
19
+ # compression on file systems, has a larger header than zlib to maintain
20
+ # directory information, and uses a different, slower check method than zlib.
21
+ #
22
+ # See your system's zlib.h for further information about zlib
23
+ #
24
+ # ## Sample usage
25
+ #
26
+ # Using the wrapper to compress strings with default parameters is quite simple:
27
+ #
28
+ # require "zlib"
29
+ #
30
+ # data_to_compress = File.read("don_quixote.txt")
31
+ #
32
+ # puts "Input size: #{data_to_compress.size}"
33
+ # #=> Input size: 2347740
34
+ #
35
+ # data_compressed = Zlib::Deflate.deflate(data_to_compress)
36
+ #
37
+ # puts "Compressed size: #{data_compressed.size}"
38
+ # #=> Compressed size: 887238
39
+ #
40
+ # uncompressed_data = Zlib::Inflate.inflate(data_compressed)
41
+ #
42
+ # puts "Uncompressed data is: #{uncompressed_data}"
43
+ # #=> Uncompressed data is: The Project Gutenberg EBook of Don Quixote...
44
+ #
45
+ # ## Class tree
46
+ #
47
+ # * Zlib::Deflate
48
+ # * Zlib::Inflate
49
+ # * Zlib::ZStream
50
+ # * Zlib::Error
51
+ # * Zlib::StreamEnd
52
+ # * Zlib::NeedDict
53
+ # * Zlib::DataError
54
+ # * Zlib::StreamError
55
+ # * Zlib::MemError
56
+ # * Zlib::BufError
57
+ # * Zlib::VersionError
58
+ # * Zlib::InProgressError
59
+ #
60
+ #
61
+ #
62
+ # (if you have GZIP_SUPPORT)
63
+ # * Zlib::GzipReader
64
+ # * Zlib::GzipWriter
65
+ # * Zlib::GzipFile
66
+ # * Zlib::GzipFile::Error
67
+ # * Zlib::GzipFile::LengthError
68
+ # * Zlib::GzipFile::CRCError
69
+ # * Zlib::GzipFile::NoFooter
70
+ #
71
+ module Zlib
72
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
73
+ # Subclass of Zlib::Error when zlib returns a Z_DATA_ERROR.
74
+ #
75
+ # Usually if a stream was prematurely freed.
76
+ #
77
+ class DataError < Zlib::Error
78
+ end
79
+ end
@@ -0,0 +1,276 @@
1
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
2
+ # This module provides access to the [zlib library](http://zlib.net). Zlib is
3
+ # designed to be a portable, free, general-purpose, legally unencumbered -- that
4
+ # is, not covered by any patents -- lossless data-compression library for use on
5
+ # virtually any computer hardware and operating system.
6
+ #
7
+ # The zlib compression library provides in-memory compression and decompression
8
+ # functions, including integrity checks of the uncompressed data.
9
+ #
10
+ # The zlib compressed data format is described in RFC 1950, which is a wrapper
11
+ # around a deflate stream which is described in RFC 1951.
12
+ #
13
+ # The library also supports reading and writing files in gzip (.gz) format with
14
+ # an interface similar to that of IO. The gzip format is described in RFC 1952
15
+ # which is also a wrapper around a deflate stream.
16
+ #
17
+ # The zlib format was designed to be compact and fast for use in memory and on
18
+ # communications channels. The gzip format was designed for single-file
19
+ # compression on file systems, has a larger header than zlib to maintain
20
+ # directory information, and uses a different, slower check method than zlib.
21
+ #
22
+ # See your system's zlib.h for further information about zlib
23
+ #
24
+ # ## Sample usage
25
+ #
26
+ # Using the wrapper to compress strings with default parameters is quite simple:
27
+ #
28
+ # require "zlib"
29
+ #
30
+ # data_to_compress = File.read("don_quixote.txt")
31
+ #
32
+ # puts "Input size: #{data_to_compress.size}"
33
+ # #=> Input size: 2347740
34
+ #
35
+ # data_compressed = Zlib::Deflate.deflate(data_to_compress)
36
+ #
37
+ # puts "Compressed size: #{data_compressed.size}"
38
+ # #=> Compressed size: 887238
39
+ #
40
+ # uncompressed_data = Zlib::Inflate.inflate(data_compressed)
41
+ #
42
+ # puts "Uncompressed data is: #{uncompressed_data}"
43
+ # #=> Uncompressed data is: The Project Gutenberg EBook of Don Quixote...
44
+ #
45
+ # ## Class tree
46
+ #
47
+ # * Zlib::Deflate
48
+ # * Zlib::Inflate
49
+ # * Zlib::ZStream
50
+ # * Zlib::Error
51
+ # * Zlib::StreamEnd
52
+ # * Zlib::NeedDict
53
+ # * Zlib::DataError
54
+ # * Zlib::StreamError
55
+ # * Zlib::MemError
56
+ # * Zlib::BufError
57
+ # * Zlib::VersionError
58
+ # * Zlib::InProgressError
59
+ #
60
+ #
61
+ #
62
+ # (if you have GZIP_SUPPORT)
63
+ # * Zlib::GzipReader
64
+ # * Zlib::GzipWriter
65
+ # * Zlib::GzipFile
66
+ # * Zlib::GzipFile::Error
67
+ # * Zlib::GzipFile::LengthError
68
+ # * Zlib::GzipFile::CRCError
69
+ # * Zlib::GzipFile::NoFooter
70
+ #
71
+ module Zlib
72
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
73
+ # Zlib::Deflate is the class for compressing data. See Zlib::ZStream for more
74
+ # information.
75
+ #
76
+ class Deflate < Zlib::ZStream
77
+ type compression_level = Integer
78
+
79
+ # <!--
80
+ # rdoc-file=ext/zlib/zlib.c
81
+ # - Zlib.deflate(string[, level])
82
+ # - Zlib::Deflate.deflate(string[, level])
83
+ # -->
84
+ # Compresses the given `string`. Valid values of level are Zlib::NO_COMPRESSION,
85
+ # Zlib::BEST_SPEED, Zlib::BEST_COMPRESSION, Zlib::DEFAULT_COMPRESSION, or an
86
+ # integer from 0 to 9.
87
+ #
88
+ # This method is almost equivalent to the following code:
89
+ #
90
+ # def deflate(string, level)
91
+ # z = Zlib::Deflate.new(level)
92
+ # dst = z.deflate(string, Zlib::FINISH)
93
+ # z.close
94
+ # dst
95
+ # end
96
+ #
97
+ # See also Zlib.inflate
98
+ #
99
+ def self.deflate: (string string, ?compression_level level) -> String
100
+
101
+ public
102
+
103
+ # <!--
104
+ # rdoc-file=ext/zlib/zlib.c
105
+ # - << string
106
+ # -->
107
+ # Inputs `string` into the deflate stream just like Zlib::Deflate#deflate, but
108
+ # returns the Zlib::Deflate object itself. The output from the stream is
109
+ # preserved in output buffer.
110
+ #
111
+ def <<: (string string) -> self
112
+
113
+ # <!--
114
+ # rdoc-file=ext/zlib/zlib.c
115
+ # - z.deflate(string, flush = Zlib::NO_FLUSH) -> String
116
+ # - z.deflate(string, flush = Zlib::NO_FLUSH) { |chunk| ... } -> nil
117
+ # -->
118
+ # Inputs `string` into the deflate stream and returns the output from the
119
+ # stream. On calling this method, both the input and the output buffers of the
120
+ # stream are flushed. If `string` is nil, this method finishes the stream, just
121
+ # like Zlib::ZStream#finish.
122
+ #
123
+ # If a block is given consecutive deflated chunks from the `string` are yielded
124
+ # to the block and `nil` is returned.
125
+ #
126
+ # The `flush` parameter specifies the flush mode. The following constants may
127
+ # be used:
128
+ #
129
+ # Zlib::NO_FLUSH
130
+ # : The default
131
+ # Zlib::SYNC_FLUSH
132
+ # : Flushes the output to a byte boundary
133
+ # Zlib::FULL_FLUSH
134
+ # : SYNC_FLUSH + resets the compression state
135
+ # Zlib::FINISH
136
+ # : Pending input is processed, pending output is flushed.
137
+ #
138
+ #
139
+ # See the constants for further description.
140
+ #
141
+ def deflate: (string string, ?Integer flush) -> String
142
+ | (string string, ?Integer flush) { (String chunk) -> nil } -> nil
143
+
144
+ # <!--
145
+ # rdoc-file=ext/zlib/zlib.c
146
+ # - flush(flush = Zlib::SYNC_FLUSH) -> String
147
+ # - flush(flush = Zlib::SYNC_FLUSH) { |chunk| ... } -> nil
148
+ # -->
149
+ # This method is equivalent to `deflate('', flush)`. This method is just
150
+ # provided to improve the readability of your Ruby program. If a block is given
151
+ # chunks of deflate output are yielded to the block until the buffer is flushed.
152
+ #
153
+ # See Zlib::Deflate#deflate for detail on the `flush` constants NO_FLUSH,
154
+ # SYNC_FLUSH, FULL_FLUSH and FINISH.
155
+ #
156
+ def flush: (?Integer flush) -> String
157
+ | (?Integer flush) {(String chunk) -> nil } -> nil
158
+
159
+ # <!--
160
+ # rdoc-file=ext/zlib/zlib.c
161
+ # - params(level, strategy)
162
+ # -->
163
+ # Changes the parameters of the deflate stream to allow changes between
164
+ # different types of data that require different types of compression. Any
165
+ # unprocessed data is flushed before changing the params.
166
+ #
167
+ # See Zlib::Deflate.new for a description of `level` and `strategy`.
168
+ #
169
+ def params: (compression_level level, Integer strategy) -> void
170
+
171
+ # <!--
172
+ # rdoc-file=ext/zlib/zlib.c
173
+ # - set_dictionary(string)
174
+ # -->
175
+ # Sets the preset dictionary and returns `string`. This method is available just
176
+ # only after Zlib::Deflate.new or Zlib::ZStream#reset method was called. See
177
+ # zlib.h for details.
178
+ #
179
+ # Can raise errors of Z_STREAM_ERROR if a parameter is invalid (such as NULL
180
+ # dictionary) or the stream state is inconsistent, Z_DATA_ERROR if the given
181
+ # dictionary doesn't match the expected one (incorrect adler32 value)
182
+ #
183
+ def set_dictionary: (String dictionary) -> String
184
+
185
+ private
186
+
187
+ # <!--
188
+ # rdoc-file=ext/zlib/zlib.c
189
+ # - Zlib::Deflate.new(level=DEFAULT_COMPRESSION, window_bits=MAX_WBITS, mem_level=DEF_MEM_LEVEL, strategy=DEFAULT_STRATEGY)
190
+ # -->
191
+ # Creates a new deflate stream for compression. If a given argument is nil, the
192
+ # default value of that argument is used.
193
+ #
194
+ # The `level` sets the compression level for the deflate stream between 0 (no
195
+ # compression) and 9 (best compression). The following constants have been
196
+ # defined to make code more readable:
197
+ #
198
+ # * Zlib::DEFAULT_COMPRESSION
199
+ # * Zlib::NO_COMPRESSION
200
+ # * Zlib::BEST_SPEED
201
+ # * Zlib::BEST_COMPRESSION
202
+ #
203
+ #
204
+ # See http://www.zlib.net/manual.html#Constants for further information.
205
+ #
206
+ # The `window_bits` sets the size of the history buffer and should be between 8
207
+ # and 15. Larger values of this parameter result in better compression at the
208
+ # expense of memory usage.
209
+ #
210
+ # The `mem_level` specifies how much memory should be allocated for the internal
211
+ # compression state. 1 uses minimum memory but is slow and reduces compression
212
+ # ratio while 9 uses maximum memory for optimal speed. The default value is 8.
213
+ # Two constants are defined:
214
+ #
215
+ # * Zlib::DEF_MEM_LEVEL
216
+ # * Zlib::MAX_MEM_LEVEL
217
+ #
218
+ #
219
+ # The `strategy` sets the deflate compression strategy. The following
220
+ # strategies are available:
221
+ #
222
+ # Zlib::DEFAULT_STRATEGY
223
+ # : For normal data
224
+ # Zlib::FILTERED
225
+ # : For data produced by a filter or predictor
226
+ # Zlib::FIXED
227
+ # : Prevents dynamic Huffman codes
228
+ # Zlib::HUFFMAN_ONLY
229
+ # : Prevents string matching
230
+ # Zlib::RLE
231
+ # : Designed for better compression of PNG image data
232
+ #
233
+ #
234
+ # See the constants for further description.
235
+ #
236
+ # ## Examples
237
+ #
238
+ # ### Basic
239
+ #
240
+ # open "compressed.file", "w+" do |io|
241
+ # io << Zlib::Deflate.new.deflate(File.read("big.file"))
242
+ # end
243
+ #
244
+ # ### Custom compression
245
+ #
246
+ # open "compressed.file", "w+" do |compressed_io|
247
+ # deflate = Zlib::Deflate.new(Zlib::BEST_COMPRESSION,
248
+ # Zlib::MAX_WBITS,
249
+ # Zlib::MAX_MEM_LEVEL,
250
+ # Zlib::HUFFMAN_ONLY)
251
+ #
252
+ # begin
253
+ # open "big.file" do |big_io|
254
+ # until big_io.eof? do
255
+ # compressed_io << zd.deflate(big_io.read(16384))
256
+ # end
257
+ # end
258
+ # ensure
259
+ # deflate.close
260
+ # end
261
+ # end
262
+ #
263
+ # While this example will work, for best optimization review the flags for your
264
+ # specific time, memory usage and output space requirements.
265
+ #
266
+ def initialize: (?compression_level level, ?Integer window_bits, ?Integer mem_level, ?Integer strategy) -> void
267
+
268
+ # <!--
269
+ # rdoc-file=ext/zlib/zlib.c
270
+ # - initialize_copy(p1)
271
+ # -->
272
+ # Duplicates the deflate stream.
273
+ #
274
+ def initialize_copy: (self other) -> self
275
+ end
276
+ end
@@ -0,0 +1,89 @@
1
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
2
+ # This module provides access to the [zlib library](http://zlib.net). Zlib is
3
+ # designed to be a portable, free, general-purpose, legally unencumbered -- that
4
+ # is, not covered by any patents -- lossless data-compression library for use on
5
+ # virtually any computer hardware and operating system.
6
+ #
7
+ # The zlib compression library provides in-memory compression and decompression
8
+ # functions, including integrity checks of the uncompressed data.
9
+ #
10
+ # The zlib compressed data format is described in RFC 1950, which is a wrapper
11
+ # around a deflate stream which is described in RFC 1951.
12
+ #
13
+ # The library also supports reading and writing files in gzip (.gz) format with
14
+ # an interface similar to that of IO. The gzip format is described in RFC 1952
15
+ # which is also a wrapper around a deflate stream.
16
+ #
17
+ # The zlib format was designed to be compact and fast for use in memory and on
18
+ # communications channels. The gzip format was designed for single-file
19
+ # compression on file systems, has a larger header than zlib to maintain
20
+ # directory information, and uses a different, slower check method than zlib.
21
+ #
22
+ # See your system's zlib.h for further information about zlib
23
+ #
24
+ # ## Sample usage
25
+ #
26
+ # Using the wrapper to compress strings with default parameters is quite simple:
27
+ #
28
+ # require "zlib"
29
+ #
30
+ # data_to_compress = File.read("don_quixote.txt")
31
+ #
32
+ # puts "Input size: #{data_to_compress.size}"
33
+ # #=> Input size: 2347740
34
+ #
35
+ # data_compressed = Zlib::Deflate.deflate(data_to_compress)
36
+ #
37
+ # puts "Compressed size: #{data_compressed.size}"
38
+ # #=> Compressed size: 887238
39
+ #
40
+ # uncompressed_data = Zlib::Inflate.inflate(data_compressed)
41
+ #
42
+ # puts "Uncompressed data is: #{uncompressed_data}"
43
+ # #=> Uncompressed data is: The Project Gutenberg EBook of Don Quixote...
44
+ #
45
+ # ## Class tree
46
+ #
47
+ # * Zlib::Deflate
48
+ # * Zlib::Inflate
49
+ # * Zlib::ZStream
50
+ # * Zlib::Error
51
+ # * Zlib::StreamEnd
52
+ # * Zlib::NeedDict
53
+ # * Zlib::DataError
54
+ # * Zlib::StreamError
55
+ # * Zlib::MemError
56
+ # * Zlib::BufError
57
+ # * Zlib::VersionError
58
+ # * Zlib::InProgressError
59
+ #
60
+ #
61
+ #
62
+ # (if you have GZIP_SUPPORT)
63
+ # * Zlib::GzipReader
64
+ # * Zlib::GzipWriter
65
+ # * Zlib::GzipFile
66
+ # * Zlib::GzipFile::Error
67
+ # * Zlib::GzipFile::LengthError
68
+ # * Zlib::GzipFile::CRCError
69
+ # * Zlib::GzipFile::NoFooter
70
+ #
71
+ module Zlib
72
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
73
+ # The superclass for all exceptions raised by Ruby/zlib.
74
+ #
75
+ # The following exceptions are defined as subclasses of Zlib::Error. These
76
+ # exceptions are raised when zlib library functions return with an error status.
77
+ #
78
+ # * Zlib::StreamEnd
79
+ # * Zlib::NeedDict
80
+ # * Zlib::DataError
81
+ # * Zlib::StreamError
82
+ # * Zlib::MemError
83
+ # * Zlib::BufError
84
+ # * Zlib::VersionError
85
+ # * Zlib::InProgressError
86
+ #
87
+ class Error < StandardError
88
+ end
89
+ end
@@ -0,0 +1,115 @@
1
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
2
+ # This module provides access to the [zlib library](http://zlib.net). Zlib is
3
+ # designed to be a portable, free, general-purpose, legally unencumbered -- that
4
+ # is, not covered by any patents -- lossless data-compression library for use on
5
+ # virtually any computer hardware and operating system.
6
+ #
7
+ # The zlib compression library provides in-memory compression and decompression
8
+ # functions, including integrity checks of the uncompressed data.
9
+ #
10
+ # The zlib compressed data format is described in RFC 1950, which is a wrapper
11
+ # around a deflate stream which is described in RFC 1951.
12
+ #
13
+ # The library also supports reading and writing files in gzip (.gz) format with
14
+ # an interface similar to that of IO. The gzip format is described in RFC 1952
15
+ # which is also a wrapper around a deflate stream.
16
+ #
17
+ # The zlib format was designed to be compact and fast for use in memory and on
18
+ # communications channels. The gzip format was designed for single-file
19
+ # compression on file systems, has a larger header than zlib to maintain
20
+ # directory information, and uses a different, slower check method than zlib.
21
+ #
22
+ # See your system's zlib.h for further information about zlib
23
+ #
24
+ # ## Sample usage
25
+ #
26
+ # Using the wrapper to compress strings with default parameters is quite simple:
27
+ #
28
+ # require "zlib"
29
+ #
30
+ # data_to_compress = File.read("don_quixote.txt")
31
+ #
32
+ # puts "Input size: #{data_to_compress.size}"
33
+ # #=> Input size: 2347740
34
+ #
35
+ # data_compressed = Zlib::Deflate.deflate(data_to_compress)
36
+ #
37
+ # puts "Compressed size: #{data_compressed.size}"
38
+ # #=> Compressed size: 887238
39
+ #
40
+ # uncompressed_data = Zlib::Inflate.inflate(data_compressed)
41
+ #
42
+ # puts "Uncompressed data is: #{uncompressed_data}"
43
+ # #=> Uncompressed data is: The Project Gutenberg EBook of Don Quixote...
44
+ #
45
+ # ## Class tree
46
+ #
47
+ # * Zlib::Deflate
48
+ # * Zlib::Inflate
49
+ # * Zlib::ZStream
50
+ # * Zlib::Error
51
+ # * Zlib::StreamEnd
52
+ # * Zlib::NeedDict
53
+ # * Zlib::DataError
54
+ # * Zlib::StreamError
55
+ # * Zlib::MemError
56
+ # * Zlib::BufError
57
+ # * Zlib::VersionError
58
+ # * Zlib::InProgressError
59
+ #
60
+ #
61
+ #
62
+ # (if you have GZIP_SUPPORT)
63
+ # * Zlib::GzipReader
64
+ # * Zlib::GzipWriter
65
+ # * Zlib::GzipFile
66
+ # * Zlib::GzipFile::Error
67
+ # * Zlib::GzipFile::LengthError
68
+ # * Zlib::GzipFile::CRCError
69
+ # * Zlib::GzipFile::NoFooter
70
+ #
71
+ module Zlib
72
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
73
+ # Zlib::GzipFile is an abstract class for handling a gzip formatted compressed
74
+ # file. The operations are defined in the subclasses, Zlib::GzipReader for
75
+ # reading, and Zlib::GzipWriter for writing.
76
+ #
77
+ # GzipReader should be used by associating an IO, or IO-like, object.
78
+ #
79
+ # ## Method Catalogue
80
+ #
81
+ # * ::wrap
82
+ # * ::open (Zlib::GzipReader::open and Zlib::GzipWriter::open)
83
+ # * #close
84
+ # * #closed?
85
+ # * #comment
86
+ # * comment= (Zlib::GzipWriter#comment=)
87
+ # * #crc
88
+ # * eof? (Zlib::GzipReader#eof?)
89
+ # * #finish
90
+ # * #level
91
+ # * lineno (Zlib::GzipReader#lineno)
92
+ # * lineno= (Zlib::GzipReader#lineno=)
93
+ # * #mtime
94
+ # * mtime= (Zlib::GzipWriter#mtime=)
95
+ # * #orig_name
96
+ # * orig_name (Zlib::GzipWriter#orig_name=)
97
+ # * #os_code
98
+ # * path (when the underlying IO supports #path)
99
+ # * #sync
100
+ # * #sync=
101
+ # * #to_io
102
+ #
103
+ #
104
+ # (due to internal structure, documentation may appear under Zlib::GzipReader or
105
+ # Zlib::GzipWriter)
106
+ #
107
+ class GzipFile
108
+ # <!-- rdoc-file=ext/zlib/zlib.c -->
109
+ # Raised when the CRC checksum recorded in gzip file footer is not equivalent to
110
+ # the CRC checksum of the actual uncompressed data.
111
+ #
112
+ class CRCError < Zlib::GzipFile::Error
113
+ end
114
+ end
115
+ end