repo.or.cz
/
ruby-mogilefs-client.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
http_file: do not reopen opened file (on retry)
[ruby-mogilefs-client.git]
/
lib
/
mogilefs
/
chunker.rb
blob
27ff74352185b2dc418204e10c4fac7dc14c0205
1
# -*- encoding: binary -*-
2
class MogileFS::Chunker
3
CRLF = "\r\n"
4
attr_reader :io
5
6
def initialize(io)
7
@io = io
8
end
9
10
def write(buf)
11
rv = buf.bytesize
12
@io.write("#{rv.to_s(16)}\r\n")
13
@io.write(buf)
14
@io.write(CRLF)
15
rv
16
end
17
18
def flush
19
@io.write("0\r\n\r\n")
20
end
21
end