るりまサーチ

最速Rubyリファレンスマニュアル検索!
44件ヒット [1-44件を表示] (0.023秒)
トップページ > クラス:Net::HTTPResponse[x] > ライブラリ:net/http[x] > クエリ:net/http[x] > クエリ:read_body[x]

別のキーワード

  1. net/http get
  2. net/http start
  3. http start
  4. http get
  5. net/http set_range

キーワード

検索結果

Net::HTTPResponse#read_body {|str| .... } -> () (26135.0)

ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。

...果取得][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 ブロックを与えて大きいファイルを取得][ruby]{
require 'net/http'

uri = URI.parse('http:/...
...e.open("/path/to/big.file", "w") do |f|
# Net::HTTP#request_get と Net::HTTPResponse#read_body で少しずつ読み書き。メモリ消費が少ない。
http.request_get(uri.path) do |response|
response.read_body do |s|
f.write(s)
end
end
end
end
//}

一度ブ...

Net::HTTPResponse#read_body(dest=nil) -> String|nil (26135.0)

ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。

...果取得][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 ブロックを与えて大きいファイルを取得][ruby]{
require 'net/http'

uri = URI.parse('http:/...
...e.open("/path/to/big.file", "w") do |f|
# Net::HTTP#request_get と Net::HTTPResponse#read_body で少しずつ読み書き。メモリ消費が少ない。
http.request_get(uri.path) do |response|
response.read_body do |s|
f.write(s)
end
end
end
end
//}

一度ブ...

Net::HTTPResponse#body -> String | () | nil (8015.0)

エンティティボディを返します。

...返します。

Net::HTTPResponse
#read_body をブロック付きで呼んだ場合には
このメソッドはNet::ReadAdapter のインスタンスを返しますが、
これは使わないでください。

entity は obsolete です。

//emlist[例][ruby]{
require 'net/http'

uri = "http://w...

Net::HTTPResponse#entity -> String | () | nil (8015.0)

エンティティボディを返します。

...返します。

Net::HTTPResponse
#read_body をブロック付きで呼んだ場合には
このメソッドはNet::ReadAdapter のインスタンスを返しますが、
これは使わないでください。

entity は obsolete です。

//emlist[例][ruby]{
require 'net/http'

uri = "http://w...