33件ヒット
[1-33件を表示]
(0.233秒)
クラス
-
Net
:: HTTPResponse (11) -
URI
:: Generic (22)
キーワード
-
default
_ port (11) -
read
_ body (11)
検索結果
先頭3件
-
URI
:: Generic # port -> String | nil (38418.0) -
自身の port を文字列で返します。設定されていない場合は nil を返します。
...自身の port を文字列で返します。設定されていない場合は nil を返します。... -
URI
:: Generic # default _ port -> Integer | nil (26430.0) -
self.class.default_port を返します。
...self.class.default_port を返します。
@see URI::Generic.default_port... -
Net
:: HTTPResponse # read _ body(dest=nil) -> String|nil (3455.0) -
ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。
...い場合には nil を返します。
//emlist[例1 ブロックを与えずに一度に結果取得][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.read_body[0..10] # => "<!doctype h"
//}
//emlist[例2 ブロック......equire 'net/http'
uri = URI.parse('http://www.example.com/path/to/big.file')
Net::HTTP.start(uri.host, uri.port) do |http|
File.open("/path/to/big.file", "w") do |f|
# Net::HTTP#request_get と Net::HTTPResponse#read_body で少しずつ読み書き。メモリ消費が少ない。
http.r......equest_get(uri.path) do |response|
response.read_body do |s|
f.write(s)
end
end
end
end
//}
一度ブロックを与えずにこのメソッドを呼んだ場合には、
次からはすでに読みだしたボディを文字列として
返します。また一度ブロ...