Class: IO
- Inherits:
-
Object
- Object
- IO
- Defined in:
- lib/flv/core_extensions.rb
Instance Method Summary collapse
- #read__STRING(length, position = nil) ⇒ Object
- #read__UI16(position = nil) ⇒ Object
- #read__UI24(position = nil) ⇒ Object
- #read__UI32(position = nil) ⇒ Object
- #read__UI8(position = nil) ⇒ Object
- #write__STRING(string, position = nil) ⇒ Object
- #write__UI24(value, position = nil) ⇒ Object
- #write__UI32(value, position = nil) ⇒ Object
- #write__UI8(value, position = nil) ⇒ Object
Instance Method Details
#read__STRING(length, position = nil) ⇒ Object
84 85 86 87 |
# File 'lib/flv/core_extensions.rb', line 84 def read__STRING(length, position = nil) seek position unless position.nil? read length end |
#read__UI16(position = nil) ⇒ Object
69 70 71 72 |
# File 'lib/flv/core_extensions.rb', line 69 def read__UI16(position = nil) seek position unless position.nil? (readchar << 8) + readchar end |
#read__UI24(position = nil) ⇒ Object
74 75 76 77 |
# File 'lib/flv/core_extensions.rb', line 74 def read__UI24(position = nil) seek position unless position.nil? (readchar << 16) + (readchar << 8) + readchar end |
#read__UI32(position = nil) ⇒ Object
79 80 81 82 |
# File 'lib/flv/core_extensions.rb', line 79 def read__UI32(position = nil) seek position unless position.nil? (readchar << 24) + (readchar << 16) + (readchar << 8) + readchar end |
#read__UI8(position = nil) ⇒ Object
64 65 66 67 |
# File 'lib/flv/core_extensions.rb', line 64 def read__UI8(position = nil) seek position unless position.nil? readchar end |
#write__STRING(string, position = nil) ⇒ Object
107 108 109 110 |
# File 'lib/flv/core_extensions.rb', line 107 def write__STRING(string, position = nil) seek position unless position.nil? write string end |
#write__UI24(value, position = nil) ⇒ Object
95 96 97 98 99 100 |
# File 'lib/flv/core_extensions.rb', line 95 def write__UI24(value, position = nil) seek position unless position.nil? write [value >> 16].pack('c') write [(value >> 8) & 0xff].pack('c') write [value & 0xff].pack('c') end |
#write__UI32(value, position = nil) ⇒ Object
102 103 104 105 |
# File 'lib/flv/core_extensions.rb', line 102 def write__UI32(value, position = nil) seek position unless position.nil? write [value].pack('N') end |
#write__UI8(value, position = nil) ⇒ Object
90 91 92 93 |
# File 'lib/flv/core_extensions.rb', line 90 def write__UI8(value, position = nil) seek position unless position.nil? write [value].pack('C') end |