Class: Aliyun::OSS::HTTP::StreamPayload
- Inherits:
-
Object
- Object
- Aliyun::OSS::HTTP::StreamPayload
- Defined in:
- lib/aliyun/oss/http.rb
Overview
RestClient requires the payload to respones to :read(bytes) and return a stream. We are not doing the real read here, just return a readable stream for RestClient playload.rb treats it as:
def read(bytes=nil)
@stream.read(bytes)
end
alias :to_s :read
net_http_do_request(http, req, payload ? payload.to_s : nil,
&@block_response)
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
-
#initialize(&block) ⇒ StreamPayload
constructor
A new instance of StreamPayload.
- #read(bytes = nil) ⇒ Object
Constructor Details
#initialize(&block) ⇒ StreamPayload
Returns a new instance of StreamPayload.
98 99 100 |
# File 'lib/aliyun/oss/http.rb', line 98 def initialize(&block) @stream = StreamWriter.new(&block) end |
Instance Method Details
#close ⇒ Object
106 107 |
# File 'lib/aliyun/oss/http.rb', line 106 def close end |
#closed? ⇒ Boolean
109 110 111 |
# File 'lib/aliyun/oss/http.rb', line 109 def closed? false end |
#read(bytes = nil) ⇒ Object
102 103 104 |
# File 'lib/aliyun/oss/http.rb', line 102 def read(bytes = nil) @stream end |