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,249 @@
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:Inflate is the class for decompressing compressed data. Unlike
74
+ # Zlib::Deflate, an instance of this class is not able to duplicate (clone, dup)
75
+ # itself.
76
+ #
77
+ class Inflate < Zlib::ZStream
78
+ # <!--
79
+ # rdoc-file=ext/zlib/zlib.c
80
+ # - Zlib.inflate(string)
81
+ # - Zlib::Inflate.inflate(string)
82
+ # -->
83
+ # Decompresses `string`. Raises a Zlib::NeedDict exception if a preset
84
+ # dictionary is needed for decompression.
85
+ #
86
+ # This method is almost equivalent to the following code:
87
+ #
88
+ # def inflate(string)
89
+ # zstream = Zlib::Inflate.new
90
+ # buf = zstream.inflate(string)
91
+ # zstream.finish
92
+ # zstream.close
93
+ # buf
94
+ # end
95
+ #
96
+ # See also Zlib.deflate
97
+ #
98
+ def self.inflate: (string string) -> String
99
+
100
+ public
101
+
102
+ # <!--
103
+ # rdoc-file=ext/zlib/zlib.c
104
+ # - <<(p1)
105
+ # -->
106
+ # Same as IO.
107
+ #
108
+ def <<: (_ToS obj) -> self
109
+
110
+ # <!--
111
+ # rdoc-file=ext/zlib/zlib.c
112
+ # - add_dictionary(string)
113
+ # -->
114
+ # Provide the inflate stream with a dictionary that may be required in the
115
+ # future. Multiple dictionaries may be provided. The inflate stream will
116
+ # automatically choose the correct user-provided dictionary based on the
117
+ # stream's required dictionary.
118
+ #
119
+ def add_dictionary: (String arg0) -> void
120
+
121
+ # <!--
122
+ # rdoc-file=ext/zlib/zlib.c
123
+ # - inflate(deflate_string, buffer: nil) -> String
124
+ # - inflate(deflate_string, buffer: nil) { |chunk| ... } -> nil
125
+ # -->
126
+ # Inputs `deflate_string` into the inflate stream and returns the output from
127
+ # the stream. Calling this method, both the input and the output buffer of the
128
+ # stream are flushed. If string is `nil`, this method finishes the stream, just
129
+ # like Zlib::ZStream#finish.
130
+ #
131
+ # If a block is given consecutive inflated chunks from the `deflate_string` are
132
+ # yielded to the block and `nil` is returned.
133
+ #
134
+ # If a :buffer keyword argument is given and not nil:
135
+ #
136
+ # * The :buffer keyword should be a String, and will used as the output
137
+ # buffer. Using this option can reuse the memory required during inflation.
138
+ # * When not passing a block, the return value will be the same object as the
139
+ # :buffer keyword argument.
140
+ # * When passing a block, the yielded chunks will be the same value as the
141
+ # :buffer keyword argument.
142
+ #
143
+ #
144
+ # Raises a Zlib::NeedDict exception if a preset dictionary is needed to
145
+ # decompress. Set the dictionary by Zlib::Inflate#set_dictionary and then call
146
+ # this method again with an empty string to flush the stream:
147
+ #
148
+ # inflater = Zlib::Inflate.new
149
+ #
150
+ # begin
151
+ # out = inflater.inflate compressed
152
+ # rescue Zlib::NeedDict
153
+ # # ensure the dictionary matches the stream's required dictionary
154
+ # raise unless inflater.adler == Zlib.adler32(dictionary)
155
+ #
156
+ # inflater.set_dictionary dictionary
157
+ # inflater.inflate ''
158
+ # end
159
+ #
160
+ # # ...
161
+ #
162
+ # inflater.close
163
+ #
164
+ # See also Zlib::Inflate.new
165
+ #
166
+ def inflate: (string string, ?buffer: String) -> String
167
+ | (string string, ?buffer: String) { (String chunk) -> nil } -> nil
168
+
169
+ # <!--
170
+ # rdoc-file=ext/zlib/zlib.c
171
+ # - set_dictionary(p1)
172
+ # -->
173
+ # Sets the preset dictionary and returns `string`. This method is available
174
+ # just only after a Zlib::NeedDict exception was raised. See zlib.h for
175
+ # details.
176
+ #
177
+ def set_dictionary: (String p1) -> String
178
+
179
+ # <!--
180
+ # rdoc-file=ext/zlib/zlib.c
181
+ # - sync(string)
182
+ # -->
183
+ # Inputs `string` into the end of input buffer and skips data until a full flush
184
+ # point can be found. If the point is found in the buffer, this method flushes
185
+ # the buffer and returns false. Otherwise it returns `true` and the following
186
+ # data of full flush point is preserved in the buffer.
187
+ #
188
+ def sync: (String string) -> bool
189
+
190
+ # <!--
191
+ # rdoc-file=ext/zlib/zlib.c
192
+ # - sync_point?()
193
+ # -->
194
+ # Quoted verbatim from original documentation:
195
+ #
196
+ # What is this?
197
+ #
198
+ # `:)`
199
+ #
200
+ def sync_point?: () -> bool
201
+
202
+ private
203
+
204
+ # <!--
205
+ # rdoc-file=ext/zlib/zlib.c
206
+ # - Zlib::Inflate.new(window_bits = Zlib::MAX_WBITS)
207
+ # -->
208
+ # Creates a new inflate stream for decompression. `window_bits` sets the size
209
+ # of the history buffer and can have the following values:
210
+ #
211
+ # 0
212
+ # : Have inflate use the window size from the zlib header of the compressed
213
+ # stream.
214
+ #
215
+ # (8..15)
216
+ # : Overrides the window size of the inflate header in the compressed stream.
217
+ # The window size must be greater than or equal to the window size of the
218
+ # compressed stream.
219
+ #
220
+ # Greater than 15
221
+ # : Add 32 to window_bits to enable zlib and gzip decoding with automatic
222
+ # header detection, or add 16 to decode only the gzip format (a
223
+ # Zlib::DataError will be raised for a non-gzip stream).
224
+ #
225
+ # (-8..-15)
226
+ # : Enables raw deflate mode which will not generate a check value, and will
227
+ # not look for any check values for comparison at the end of the stream.
228
+ #
229
+ # This is for use with other formats that use the deflate compressed data
230
+ # format such as zip which provide their own check values.
231
+ #
232
+ #
233
+ # ## Example
234
+ #
235
+ # open "compressed.file" do |compressed_io|
236
+ # zi = Zlib::Inflate.new(Zlib::MAX_WBITS + 32)
237
+ #
238
+ # begin
239
+ # open "uncompressed.file", "w+" do |uncompressed_io|
240
+ # uncompressed_io << zi.inflate(compressed_io.read)
241
+ # end
242
+ # ensure
243
+ # zi.close
244
+ # end
245
+ # end
246
+ #
247
+ def initialize: (?Integer window_bits) -> void
248
+ end
249
+ 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
74
+ #
75
+ # When zlib returns a Z_MEM_ERROR, usually if there was not enough memory.
76
+ #
77
+ class MemError < Zlib::Error
78
+ end
79
+ end
@@ -0,0 +1,82 @@
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
74
+ #
75
+ # When zlib returns a Z_NEED_DICT if a preset dictionary is needed at this
76
+ # point.
77
+ #
78
+ # Used by Zlib::Inflate.inflate and `Zlib.inflate`
79
+ #
80
+ class NeedDict < Zlib::Error
81
+ end
82
+ end
@@ -0,0 +1,80 @@
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
74
+ #
75
+ # When zlib returns a Z_STREAM_END is return if the end of the compressed data
76
+ # has been reached and all uncompressed out put has been produced.
77
+ #
78
+ class StreamEnd < Zlib::Error
79
+ end
80
+ end
@@ -0,0 +1,80 @@
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
74
+ #
75
+ # When zlib returns a Z_STREAM_ERROR, usually if the stream state was
76
+ # inconsistent.
77
+ #
78
+ class StreamError < Zlib::Error
79
+ end
80
+ end
@@ -0,0 +1,80 @@
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
74
+ #
75
+ # When zlib returns a Z_VERSION_ERROR, usually if the zlib library version is
76
+ # incompatible with the version assumed by the caller.
77
+ #
78
+ class VersionError < Zlib::Error
79
+ end
80
+ end