kzk/webhdfs — pull request #11 by shoichikaji (2014-10-22 18:36:24+00:00)
Title: accept IO-like object as payload

Currently webhdfs gem accepts IO objects as payloads.
This pull request relaxes it so that it accepts IO-like objects (i.e. objects that have read and size methods).

Let me explain why I need this modification.
I want fluent-plugin-webhdfs to support gzip compression.
If webhdfs gem accepts this patch, then I can write the following code:
```ruby
require 'zlib'
require 'tempfile'
require 'webhdfs'
client = WebHDFS::Client.new("host", 50070)
content = "this is sample"

tmp = Tempfile.new("webhdfs-")
begin
w = Zlib::GzipWriter.new(tmp)
w.puts(content)
w.close
tmp.close
tmp.open
client.create("/path/to/file.gz", tmp)
ensure
tmp.close(true) rescue nil
end
```