Class: Wiris::BytesInput
- Inherits:
-
Object
- Object
- Wiris::BytesInput
- Defined in:
- lib/src-generic/BytesInput.rb
Instance Method Summary collapse
- #binary ⇒ Object
-
#initialize(bs) ⇒ BytesInput
constructor
A new instance of BytesInput.
- #readByte ⇒ Object
- #readBytes(bytes, pos, len) ⇒ Object
- #readInt32 ⇒ Object
Constructor Details
#initialize(bs) ⇒ BytesInput
Returns a new instance of BytesInput.
7 8 9 |
# File 'lib/src-generic/BytesInput.rb', line 7 def initialize(bs) @binary = bs.getData().to_enum end |
Instance Method Details
#binary ⇒ Object
3 4 5 |
# File 'lib/src-generic/BytesInput.rb', line 3 def binary() @binary end |
#readByte ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/src-generic/BytesInput.rb', line 15 def readByte() byt = @binary.next if byt.nil? return false else return byt end end |
#readBytes(bytes, pos, len) ⇒ Object
11 12 13 |
# File 'lib/src-generic/BytesInput.rb', line 11 def readBytes(b, pos, len) return @binary[pos..len] end |
#readInt32 ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/src-generic/BytesInput.rb', line 23 def readInt32() c1 = readByte c2 = readByte c3 = readByte c4 = readByte return (c1 << 8 | c2) << 16 | (c3 << 8 | c4) end |