Class: Wiris::BytesInput

Inherits:
Object
  • Object
show all
Defined in:
lib/src-generic/BytesInput.rb

Instance Method Summary collapse

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

#binaryObject



3
4
5
# File 'lib/src-generic/BytesInput.rb', line 3

def binary()
	@binary
end

#readByteObject



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

#readInt32Object



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