Module: AMF::Pure::IOHelperRead
Overview
Instance Method Summary
collapse
#byte_order, #byte_order_little?
Instance Method Details
#read_double(source) ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/amf/pure/helpers/io_helper_read.rb', line 28
def read_double(source)
bytes_to_read = 8
raise AMFErrorIncomplete.new if bytes_to_read > (source.size - source.pos)
source.read(bytes_to_read).unpack('G').first
end
|
#read_int16_network(source) ⇒ Object
46
47
48
49
50
51
52
53
54
|
# File 'lib/amf/pure/helpers/io_helper_read.rb', line 46
def read_int16_network(source)
bytes_to_read = 2
raise AMFErrorIncomplete.new if bytes_to_read > (source.size - source.pos)
result = source.read(bytes_to_read)
result.reverse! if byte_order_little? result.unpack('s').first
end
|
#read_int8(source) ⇒ Object
14
15
16
17
18
|
# File 'lib/amf/pure/helpers/io_helper_read.rb', line 14
def read_int8(source)
raise AMFErrorIncomplete.new if source.eof?
source.read(1).unpack('c').first
end
|
#read_word16_network(source) ⇒ Object
37
38
39
40
41
42
43
|
# File 'lib/amf/pure/helpers/io_helper_read.rb', line 37
def read_word16_network(source)
bytes_to_read = 2
raise AMFErrorIncomplete.new if bytes_to_read > (source.size - source.pos)
source.read(2).unpack('n').first
end
|
#read_word32_network(source) ⇒ Object
57
58
59
60
61
62
63
|
# File 'lib/amf/pure/helpers/io_helper_read.rb', line 57
def read_word32_network(source)
bytes_to_read = 4
raise AMFErrorIncomplete.new if bytes_to_read > (source.size - source.pos)
source.read(bytes_to_read).unpack('N').first
end
|
#read_word8(source) ⇒ Object
21
22
23
24
25
|
# File 'lib/amf/pure/helpers/io_helper_read.rb', line 21
def read_word8(source)
raise AMFErrorIncomplete.new if source.eof?
source.read(1).unpack('C').first
end
|