Class: RazyK::WebApp::InputStream
- Inherits:
-
Object
- Object
- RazyK::WebApp::InputStream
- Defined in:
- lib/razyk/webapp.rb
Instance Method Summary collapse
- #getbyte ⇒ Object
-
#initialize(str = "") ⇒ InputStream
constructor
A new instance of InputStream.
- #remain ⇒ Object
- #wrote ⇒ Object
Constructor Details
#initialize(str = "") ⇒ InputStream
Returns a new instance of InputStream.
11 12 13 14 |
# File 'lib/razyk/webapp.rb', line 11 def initialize(str="") @buf = str.b @chars = [] end |
Instance Method Details
#getbyte ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/razyk/webapp.rb', line 15 def getbyte if @buf ret = @buf.unpack("C")[0] @buf = @buf[1..-1] if ret @chars << ret end ret else nil end end |
#remain ⇒ Object
30 31 32 |
# File 'lib/razyk/webapp.rb', line 30 def remain @buf || "" end |
#wrote ⇒ Object
27 28 29 |
# File 'lib/razyk/webapp.rb', line 27 def wrote @chars.pack("C*") end |