Zlib::ZStream
is the abstract class for the stream which handles the compressed data. The operations are defined in the subclasses: Zlib::Deflate
for compression, and Zlib::Inflate
for decompression.
An instance of Zlib::ZStream
has one stream (struct zstream in the source) and two variable-length buffers which associated to the input (next_in) of the stream and the output (next_out) of the stream. In this document, “input buffer” means the buffer for input, and “output buffer” means the buffer for output.
Data
input into an instance of Zlib::ZStream
are temporally stored into the end of input buffer, and then data in input buffer are processed from the beginning of the buffer until no more output from the stream is produced (i.e. until avail_out
> 0 after processing). During processing, output buffer is allocated and expanded automatically to hold all output data.
Some particular instance methods consume the data in output buffer and return them as a String
.
Here is an ascii art for describing above:
+================ an instance of Zlib::ZStream ================+ || || || +--------+ +-------+ +--------+ || || +--| output |<---------|zstream|<---------| input |<--+ || || | | buffer | next_out+-------+next_in | buffer | | || || | +--------+ +--------+ | || || | | || +===|======================================================|===+ | | v | "output data" "input data"
If an error occurs during processing input buffer, an exception which is a subclass of Zlib::Error
is raised. At that time, both input and output buffer keep their conditions at the time when the error occurs.
Method
Catalogue Many of the methods in this class are fairly low-level and unlikely to be of interest to users. In fact, users are unlikely to use this class directly; rather they will be interested in Zlib::Inflate
and Zlib::Deflate
.
The higher level methods are listed below.
HTTPGenericRequest is the parent of the Net::HTTPRequest
class.
Do not use this directly; instead, use a subclass of Net::HTTPRequest
.
This class is the base class for Net::HTTP request classes. The class should not be used directly; instead you should use its subclasses, listed below.
An request object may be created with either a URI
or a string hostname:
require 'net/http' uri = URI('https://jsonplaceholder.typicode.com/') req = Net::HTTP::Get.new(uri) # => #<Net::HTTP::Get GET> req = Net::HTTP::Get.new(uri.hostname) # => #<Net::HTTP::Get GET>
And with any of the subclasses:
req = Net::HTTP::Head.new(uri) # => #<Net::HTTP::Head HEAD> req = Net::HTTP::Post.new(uri) # => #<Net::HTTP::Post POST> req = Net::HTTP::Put.new(uri) # => #<Net::HTTP::Put PUT> # ...
The new instance is suitable for use as the argument to Net::HTTP#request
.
A new request object has these header fields by default:
req.to_hash # => {"accept-encoding"=>["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"], "accept"=>["*/*"], "user-agent"=>["Ruby"], "host"=>["jsonplaceholder.typicode.com"]}
See:
You can add headers or override default headers:
# res = Net::HTTP::Get.new(uri, {'foo' => '0', 'bar' => '1'})
This class (and therefore its subclasses) also includes (indirectly) module Net::HTTPHeader
, which gives access to its methods for setting headers.
Subclasses for HTTP requests:
Subclasses for WebDAV requests:
Response class for Bad Request
responses (status code 400).
The server cannot or will not process the request due to an apparent client error.
References:
Response class for Request Timeout
responses (status code 408).
The server timed out waiting for the request.
References:
Response class for Request Timeout
responses (status code 408).
The server timed out waiting for the request.
References:
Response class for Payload Too Large
responses (status code 413).
The request is larger than the server is willing or able to process.
References:
Response class for URI Too Long
responses (status code 414).
The URI
provided was too long for the server to process.
References:
Response class for Range Not Satisfiable
responses (status code 416).
The request entity has a media type which the server or resource does not support.
References:
Response class for Too Many Requests
responses (status code 429).
The user has sent too many requests in a given amount of time.
References:
Response class for HTTP Version Not Supported
responses (status code 505).
The server does not support the HTTP
version used in the request.
References:
Represents an ‘ensure` clause in a `begin` statement.
begin foo ensure ^^^^^^ bar end
Represents using a trailing comma to indicate an implicit rest parameter.
foo { |bar,| } ^ foo in [bar,] ^ for foo, in bar do end ^ foo, = bar ^
Represents a keyword rest parameter to a method, block, or lambda definition.
def a(**b) ^^^ end
Represents the use of the ‘^` operator for pinning an expression in a pattern matching expression.
foo in ^(bar) ^^^^^^
Represents a rest parameter to a method, block, or lambda definition.
def a(*b) ^^ end
Represents a set of statements contained within some scope.
foo; bar; baz ^^^^^^^^^^^^^
EmbDocComment
objects correspond to comments that are surrounded by =begin and =end.
Raised when trying to use a canceled tuple.
Raised when trying to activate a gem, and the gem exists on the system, but not the requested version. Instead of rescuing from this class, make sure to rescue from the superclass Gem::LoadError
to catch all types of load errors.
Raised by Gem::Resolver
when a Gem::Dependency::Conflict reaches the toplevel. Indicates which dependencies were incompatible through conflict
and conflicting_dependencies