Module: Ronin::Support::Binary::Stream::Methods Private
- Included in:
- IO, Ronin::Support::Binary::Stream
- Defined in:
- lib/ronin/support/binary/stream/methods.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Adds read_*
/write_*
methods for reading and writing binary data
types.
Reader Methods collapse
-
#read_array(type, length) ⇒ Binary::Array
Reads an array of the given type and length from the stream.
-
#read_array_of(type, count) ⇒ Array<Object>
Reads an array of the given type, starting at the given with the given length.
-
#read_array_of_byte(count) ⇒ Array<Integer, nil>
(also: #read_bytes)
Alias to
read_array_of(:byte,count)
. -
#read_array_of_char(count) ⇒ Array<Integer, nil>
(also: #read_chars)
Alias to
read_array_of(:char,count)
. -
#read_array_of_double(count) ⇒ Array<Float, nil>
(also: #read_doubles)
Alias to
read_array_of(:double,count)
. -
#read_array_of_float(count) ⇒ Array<Float, nil>
(also: #read_floats)
Alias to
read_array_of(:float,count)
. -
#read_array_of_float32(count) ⇒ Array<Float, nil>
Alias to
read_array_of(:float32,count)
. -
#read_array_of_float64(count) ⇒ Array<Float, nil>
Alias to
read_array_of(:float64,count)
. -
#read_array_of_int(count) ⇒ Array<Integer, nil>
(also: #read_ints)
Alias to
read_array_of(:int,count)
. -
#read_array_of_int16(count) ⇒ Array<Integer, nil>
Alias to
read_array_of(:int16,count)
. -
#read_array_of_int32(count) ⇒ Array<Integer, nil>
Alias to
read_array_of(:int32,count)
. -
#read_array_of_int64(count) ⇒ Array<Integer, nil>
Alias to
read_array_of(:int64,count)
. -
#read_array_of_int8(count) ⇒ Array<Integer, nil>
Alias to
read_array_of(:int8,count)
. -
#read_array_of_long(count) ⇒ Array<Integer, nil>
Alias to
read_array_of(:long,count)
. -
#read_array_of_long_long(count) ⇒ Array<Integer, nil>
Alias to
read_array_of(:long_long,count)
. -
#read_array_of_short(count) ⇒ Array<Integer, nil>
Alias to
read_array_of(:short,count)
. -
#read_array_of_uchar(count) ⇒ Array<Integer, nil>
(also: #read_uchars)
Alias to
read_array_of(:uchar,count)
. -
#read_array_of_uint(count) ⇒ Array<Integer, nil>
(also: #read_uints)
Alias to
read_array_of(:uint,count)
. -
#read_array_of_uint16(count) ⇒ Array<Integer, nil>
Alias to
read_array_of(:uint16,count)
. -
#read_array_of_uint32(count) ⇒ Array<Integer, nil>
Alias to
read_array_of(:uint32,count)
. -
#read_array_of_uint64(count) ⇒ Array<Integer, nil>
Alias to
read_array_of(:uint64,count)
. -
#read_array_of_uint8(count) ⇒ Array<Integer, nil>
Alias to
read_array_of(:uint8,count)
. -
#read_array_of_ulong(count) ⇒ Array<Integer, nil>
Alias to
read_array_of(:ulong,count)
. -
#read_array_of_ulong_long(count) ⇒ Array<Integer, nil>
Alias to
read_array_of(:ulong_long,count)
. -
#read_array_of_ushort(count) ⇒ Array<Integer, nil>
Alias to
read_array_of(:ushort,count)
. -
#read_buffer(count) ⇒ Buffer
Reads a buffer of count bytes from the stream.
-
#read_byte ⇒ Integer
Alias for
read_value(:byte)
. -
#read_char ⇒ String
Alias for
read_value(:char)
. -
#read_double ⇒ Float?
Alias for
read_value(:double)
. -
#read_float ⇒ Float?
Alias for
read_value(:float)
. -
#read_float32 ⇒ Float?
Alias for
read_value(:float32)
. -
#read_float64 ⇒ Float?
Alias for
read_value(:float64)
. -
#read_int ⇒ Integer?
Alias for
read_value(:int)
. -
#read_int16 ⇒ Integer?
Alias for
read_value(:int16)
. -
#read_int32 ⇒ Integer?
Alias for
read_value(:int32)
. -
#read_int64 ⇒ Integer?
Alias for
read_value(:int64)
. -
#read_int8 ⇒ Integer?
Alias for
read_value(:int8)
. -
#read_into(memory) ⇒ Buffer, ...
Reads data from the stream into the memory object.
-
#read_long ⇒ Integer?
Alias for
read_value(:long)
. -
#read_long_long ⇒ Integer?
Alias for
read_value(:long_long)
. -
#read_short ⇒ Integer?
Alias for
read_value(:short)
. -
#read_string(length = nil) ⇒ String
Reads a null-byte terminated C string from the buffer.
-
#read_struct(struct_class) ⇒ Binary::Struct
Reads a struct from the stream.
-
#read_uchar ⇒ String
Alias for
read_value(:uchar)
. -
#read_uint ⇒ Integer?
Alias for
read_value(:uint)
. -
#read_uint16 ⇒ Integer?
Alias for
read_value(:uint16)
. -
#read_uint32 ⇒ Integer?
Alias for
read_value(:uint32)
. -
#read_uint64 ⇒ Integer?
Alias for
read_value(:uint64)
. -
#read_uint8 ⇒ Integer?
Alias for
read_value(:uint8)
. -
#read_ulong ⇒ Integer?
Alias for
read_value(:ulong)
. -
#read_ulong_long ⇒ Integer?
Alias for
read_value(:ulong_long)
. -
#read_union(union_class) ⇒ Binary::Union
Reads a union from the stream.
-
#read_ushort ⇒ Integer?
Alias for
read_value(:ushort)
. -
#read_value(type) ⇒ Integer, ...
Reads a value of the given type from the IO stream.
Writer Methods collapse
-
#write_array_of(type, array) ⇒ self
Writes an array of the given type.
-
#write_array_of_byte(bytes) ⇒ self
(also: #write_bytes)
Alias to
write_array_of(:byte,bytes)
. -
#write_array_of_char(chars) ⇒ self
(also: #write_chars)
Alias to
write_array_of(:char,bytes)
. -
#write_array_of_double(floats) ⇒ self
(also: #write_doubles)
Alias to
write_array_of(:double,floats)
. -
#write_array_of_float(floats) ⇒ self
(also: #write_floats)
Alias to
write_array_of(:float,floats)
. -
#write_array_of_float32(floats) ⇒ self
Alias to
write_array_of(:float32,floats)
. -
#write_array_of_float64(floats) ⇒ self
Alias to
write_array_of(:float64,floats)
. -
#write_array_of_int(ints) ⇒ self
(also: #write_ints)
Alias to
write_array_of(:int,ints)
. -
#write_array_of_int16(ints) ⇒ self
Alias to
write_array_of(:int16,ints)
. -
#write_array_of_int32(ints) ⇒ self
Alias to
write_array_of(:int32,ints)
. -
#write_array_of_int64(ints) ⇒ self
Alias to
write_array_of(:int64,ints)
. -
#write_array_of_int8(ints) ⇒ self
Alias to
write_array_of(:int8,ints)
. -
#write_array_of_long(ints) ⇒ self
Alias to
write_array_of(:long,ints)
. -
#write_array_of_long_long(ints) ⇒ self
Alias to
write_array_of(:long_long,ints)
. -
#write_array_of_short(ints) ⇒ self
Alias to
write_array_of(:short,ints)
. -
#write_array_of_uchar(chars) ⇒ self
(also: #write_uchars)
Alias to
write_array_of(:uchar,bytes)
. -
#write_array_of_uint(uints) ⇒ self
(also: #write_uints)
Alias to
write_array_of(:uint,uints)
. -
#write_array_of_uint16(uints) ⇒ self
Alias to
write_array_of(:uint16,uints)
. -
#write_array_of_uint32(uints) ⇒ self
Alias to
write_array_of(:uint32,uints)
. -
#write_array_of_uint64(uints) ⇒ self
Alias to
write_array_of(:uint64,uints)
. -
#write_array_of_uint8(uints) ⇒ self
Alias to
write_array_of(:uint8,uints)
. -
#write_array_of_ulong(uints) ⇒ self
Alias to
write_array_of(:ulong,uints)
. -
#write_array_of_ulong_long(uints) ⇒ self
Alias to
write_array_of(:ulong_long,uints)
. -
#write_array_of_ushort(uints) ⇒ self
Alias to
write_array_of(:ushort,uints)
. -
#write_byte(value) ⇒ self
Alias for
write_value(:byte,value)
. -
#write_char(value) ⇒ self
Alias for
write_value(:char,value)
. -
#write_double(value) ⇒ self
Alias for
write_value(:double,value)
. -
#write_float(value) ⇒ self
Alias for
write_value(:float,value)
. -
#write_float32(value) ⇒ self
Alias for
write_value(:float32,value)
. -
#write_float64(value) ⇒ self
Alias for
write_value(:float64,value)
. -
#write_int(value) ⇒ self
Alias for
write_value(:int,value)
. -
#write_int16(value) ⇒ self
Alias for
write_value(:int16,value)
. -
#write_int32(value) ⇒ self
Alias for
write_value(:int32,value)
. -
#write_int64(value) ⇒ self
Alias for
write_value(:int64,value)
. -
#write_int8(value) ⇒ self
Alias for
write_value(:int8,value)
. -
#write_long(value) ⇒ self
Alias for
write_value(:long,value)
. -
#write_long_long(value) ⇒ self
Alias for
write_value(:long_long,value)
. -
#write_short(value) ⇒ self
Alias for
write_value(:short,value)
. -
#write_string(string) ⇒ self
Writes a null-terminated C string to the buffer.
-
#write_uchar(value) ⇒ self
Alias for
write_value(:uchar,value)
. -
#write_uint(value) ⇒ self
Alias for
write_value(:uint,value)
. -
#write_uint16(value) ⇒ self
Alias for
write_value(:uint16,value)
. -
#write_uint32(value) ⇒ self
Alias for
write_value(:uint32,value)
. -
#write_uint64(value) ⇒ self
Alias for
write_value(:uint64,value)
. -
#write_uint8(value) ⇒ self
Alias for
write_value(:uint8,value)
. -
#write_ulong(value) ⇒ self
Alias for
write_value(:ulong,value)
. -
#write_ulong_long(value) ⇒ self
Alias for
write_value(:ulong_long,value)
. -
#write_ushort(value) ⇒ self
Alias for
write_value(:ushort,value)
. -
#write_value(type, value) ⇒ self
Writes the value to the IO stream.
Instance Method Details
#read_array(type, length) ⇒ Binary::Array
Reads an array of the given type and length from the stream.
899 900 901 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 899 def read_array(type,length) Array.read_from(self,type,length) end |
#read_array_of(type, count) ⇒ Array<Object>
Reads an array of the given type, starting at the given with the given length.
436 437 438 439 440 441 442 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 436 def read_array_of(type,count) type = type_system[type] array_type = type[count] data = read(array_type.size) return array_type.unpack(data) end |
#read_array_of_byte(count) ⇒ Array<Integer, nil> Also known as: read_bytes
Alias to read_array_of(:byte,count)
.
457 458 459 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 457 def read_array_of_byte(count) read_array_of(:byte,count) end |
#read_array_of_char(count) ⇒ Array<Integer, nil> Also known as: read_chars
Alias to read_array_of(:char,count)
.
476 477 478 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 476 def read_array_of_char(count) read_array_of(:char,count) end |
#read_array_of_double(count) ⇒ Array<Float, nil> Also known as: read_doubles
Alias to read_array_of(:double,count)
.
843 844 845 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 843 def read_array_of_double(count) read_array_of(:double,count) end |
#read_array_of_float(count) ⇒ Array<Float, nil> Also known as: read_floats
Alias to read_array_of(:float,count)
.
824 825 826 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 824 def read_array_of_float(count) read_array_of(:float,count) end |
#read_array_of_float32(count) ⇒ Array<Float, nil>
Alias to read_array_of(:float32,count)
.
790 791 792 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 790 def read_array_of_float32(count) read_array_of(:float32,count) end |
#read_array_of_float64(count) ⇒ Array<Float, nil>
Alias to read_array_of(:float64,count)
.
807 808 809 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 807 def read_array_of_float64(count) read_array_of(:float64,count) end |
#read_array_of_int(count) ⇒ Array<Integer, nil> Also known as: read_ints
Alias to read_array_of(:int,count)
.
667 668 669 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 667 def read_array_of_int(count) read_array_of(:int,count) end |
#read_array_of_int16(count) ⇒ Array<Integer, nil>
Alias to read_array_of(:int16,count)
.
531 532 533 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 531 def read_array_of_int16(count) read_array_of(:int16,count) end |
#read_array_of_int32(count) ⇒ Array<Integer, nil>
Alias to read_array_of(:int32,count)
.
548 549 550 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 548 def read_array_of_int32(count) read_array_of(:int32,count) end |
#read_array_of_int64(count) ⇒ Array<Integer, nil>
Alias to read_array_of(:int64,count)
.
565 566 567 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 565 def read_array_of_int64(count) read_array_of(:int64,count) end |
#read_array_of_int8(count) ⇒ Array<Integer, nil>
Alias to read_array_of(:int8,count)
.
514 515 516 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 514 def read_array_of_int8(count) read_array_of(:int8,count) end |
#read_array_of_long(count) ⇒ Array<Integer, nil>
Alias to read_array_of(:long,count)
.
686 687 688 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 686 def read_array_of_long(count) read_array_of(:long,count) end |
#read_array_of_long_long(count) ⇒ Array<Integer, nil>
Alias to read_array_of(:long_long,count)
.
703 704 705 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 703 def read_array_of_long_long(count) read_array_of(:long_long,count) end |
#read_array_of_short(count) ⇒ Array<Integer, nil>
Alias to read_array_of(:short,count)
.
650 651 652 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 650 def read_array_of_short(count) read_array_of(:short,count) end |
#read_array_of_uchar(count) ⇒ Array<Integer, nil> Also known as: read_uchars
Alias to read_array_of(:uchar,count)
.
495 496 497 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 495 def read_array_of_uchar(count) read_array_of(:uchar,count) end |
#read_array_of_uint(count) ⇒ Array<Integer, nil> Also known as: read_uints
Alias to read_array_of(:uint,count)
.
737 738 739 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 737 def read_array_of_uint(count) read_array_of(:uint,count) end |
#read_array_of_uint16(count) ⇒ Array<Integer, nil>
Alias to read_array_of(:uint16,count)
.
599 600 601 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 599 def read_array_of_uint16(count) read_array_of(:uint16,count) end |
#read_array_of_uint32(count) ⇒ Array<Integer, nil>
Alias to read_array_of(:uint32,count)
.
616 617 618 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 616 def read_array_of_uint32(count) read_array_of(:uint32,count) end |
#read_array_of_uint64(count) ⇒ Array<Integer, nil>
Alias to read_array_of(:uint64,count)
.
633 634 635 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 633 def read_array_of_uint64(count) read_array_of(:uint64,count) end |
#read_array_of_uint8(count) ⇒ Array<Integer, nil>
Alias to read_array_of(:uint8,count)
.
582 583 584 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 582 def read_array_of_uint8(count) read_array_of(:uint8,count) end |
#read_array_of_ulong(count) ⇒ Array<Integer, nil>
Alias to read_array_of(:ulong,count)
.
756 757 758 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 756 def read_array_of_ulong(count) read_array_of(:ulong,count) end |
#read_array_of_ulong_long(count) ⇒ Array<Integer, nil>
Alias to read_array_of(:ulong_long,count)
.
773 774 775 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 773 def read_array_of_ulong_long(count) read_array_of(:ulong_long,count) end |
#read_array_of_ushort(count) ⇒ Array<Integer, nil>
Alias to read_array_of(:ushort,count)
.
720 721 722 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 720 def read_array_of_ushort(count) read_array_of(:ushort,count) end |
#read_buffer(count) ⇒ Buffer
Reads a buffer of count bytes from the stream.
879 880 881 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 879 def read_buffer(count) Buffer.read_from(self,count) end |
#read_byte ⇒ Integer
Alias for read_value(:byte)
.
70 71 72 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 70 def read_byte read_value(:byte) end |
#read_char ⇒ String
Alias for read_value(:char)
.
84 85 86 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 84 def read_char read_value(:char) end |
#read_double ⇒ Float?
Alias for read_value(:double)
.
417 418 419 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 417 def read_double read_value(:double) end |
#read_float ⇒ Float?
Alias for read_value(:float)
.
403 404 405 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 403 def read_float read_value(:float) end |
#read_float32 ⇒ Float?
Alias for read_value(:float32)
.
375 376 377 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 375 def read_float32 read_value(:float32) end |
#read_float64 ⇒ Float?
Alias for read_value(:float64)
.
389 390 391 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 389 def read_float64 read_value(:float64) end |
#read_int ⇒ Integer?
Alias for read_value(:int)
.
277 278 279 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 277 def read_int read_value(:int) end |
#read_int16 ⇒ Integer?
Alias for read_value(:int16)
.
165 166 167 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 165 def read_int16 read_value(:int16) end |
#read_int32 ⇒ Integer?
Alias for read_value(:int32)
.
179 180 181 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 179 def read_int32 read_value(:int32) end |
#read_int64 ⇒ Integer?
Alias for read_value(:int64)
.
193 194 195 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 193 def read_int64 read_value(:int64) end |
#read_int8 ⇒ Integer?
Alias for read_value(:int8)
.
151 152 153 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 151 def read_int8 read_value(:int8) end |
#read_into(memory) ⇒ Buffer, ...
Reads data from the stream into the memory object.
862 863 864 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 862 def read_into(memory) memory.read_from(self) end |
#read_long ⇒ Integer?
Alias for read_value(:long)
.
291 292 293 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 291 def read_long read_value(:long) end |
#read_long_long ⇒ Integer?
Alias for read_value(:long_long)
.
305 306 307 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 305 def read_long_long read_value(:long_long) end |
#read_short ⇒ Integer?
Alias for read_value(:short)
.
263 264 265 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 263 def read_short read_value(:short) end |
#read_string(length = nil) ⇒ String
Reads a null-byte terminated C string from the buffer.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 113 def read_string(length=nil) new_string = if (encoding = external_encoding) String.new('', encoding: encoding) else String.new('') end if length length.times do if eof? || ((c = read(1)) == "\0") break end new_string << c end else until eof? if ((c = read(1)) == "\0") break end new_string << c end end return new_string end |
#read_struct(struct_class) ⇒ Binary::Struct
Reads a struct from the stream.
916 917 918 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 916 def read_struct(struct_class) struct_class.read_from(self) end |
#read_uchar ⇒ String
Alias for read_value(:uchar)
.
98 99 100 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 98 def read_uchar read_value(:uchar) end |
#read_uint ⇒ Integer?
Alias for read_value(:uint)
.
333 334 335 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 333 def read_uint read_value(:uint) end |
#read_uint16 ⇒ Integer?
Alias for read_value(:uint16)
.
221 222 223 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 221 def read_uint16 read_value(:uint16) end |
#read_uint32 ⇒ Integer?
Alias for read_value(:uint32)
.
235 236 237 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 235 def read_uint32 read_value(:uint32) end |
#read_uint64 ⇒ Integer?
Alias for read_value(:uint64)
.
249 250 251 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 249 def read_uint64 read_value(:uint64) end |
#read_uint8 ⇒ Integer?
Alias for read_value(:uint8)
.
207 208 209 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 207 def read_uint8 read_value(:uint8) end |
#read_ulong ⇒ Integer?
Alias for read_value(:ulong)
.
347 348 349 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 347 def read_ulong read_value(:ulong) end |
#read_ulong_long ⇒ Integer?
Alias for read_value(:ulong_long)
.
361 362 363 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 361 def read_ulong_long read_value(:ulong_long) end |
#read_union(union_class) ⇒ Binary::Union
Reads a union from the stream.
933 934 935 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 933 def read_union(union_class) union_class.read_from(self) end |
#read_ushort ⇒ Integer?
Alias for read_value(:ushort)
.
319 320 321 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 319 def read_ushort read_value(:ushort) end |
#read_value(type) ⇒ Integer, ...
Reads a value of the given type from the IO stream.
52 53 54 55 56 57 58 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 52 def read_value(type) type = type_system[type] if (slice = read(type.size)) type.unpack(slice) end end |
#write_array_of(type, array) ⇒ self
Writes an array of the given type.
1365 1366 1367 1368 1369 1370 1371 1372 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1365 def write_array_of(type,array) type = type_system[type] array_type = type[array.length] data = array_type.pack(array) write(data) return self end |
#write_array_of_byte(bytes) ⇒ self Also known as: write_bytes
Alias to write_array_of(:byte,bytes)
.
1386 1387 1388 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1386 def write_array_of_byte(bytes) write_array_of(:byte,bytes) end |
#write_array_of_char(chars) ⇒ self Also known as: write_chars
Alias to write_array_of(:char,bytes)
.
1404 1405 1406 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1404 def write_array_of_char(chars) write_array_of(:char,chars) end |
#write_array_of_double(floats) ⇒ self Also known as: write_doubles
Alias to write_array_of(:double,floats)
.
1750 1751 1752 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1750 def write_array_of_double(floats) write_array_of(:double,floats) end |
#write_array_of_float(floats) ⇒ self Also known as: write_floats
Alias to write_array_of(:float,floats)
.
1732 1733 1734 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1732 def write_array_of_float(floats) write_array_of(:float,floats) end |
#write_array_of_float32(floats) ⇒ self
Alias to write_array_of(:float32,floats)
.
1700 1701 1702 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1700 def write_array_of_float32(floats) write_array_of(:float32,floats) end |
#write_array_of_float64(floats) ⇒ self
Alias to write_array_of(:float64,floats)
.
1716 1717 1718 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1716 def write_array_of_float64(floats) write_array_of(:float64,floats) end |
#write_array_of_int(ints) ⇒ self Also known as: write_ints
Alias to write_array_of(:int,ints)
.
1584 1585 1586 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1584 def write_array_of_int(ints) write_array_of(:int,ints) end |
#write_array_of_int16(ints) ⇒ self
Alias to write_array_of(:int16,ints)
.
1456 1457 1458 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1456 def write_array_of_int16(ints) write_array_of(:int16,ints) end |
#write_array_of_int32(ints) ⇒ self
Alias to write_array_of(:int32,ints)
.
1472 1473 1474 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1472 def write_array_of_int32(ints) write_array_of(:int32,ints) end |
#write_array_of_int64(ints) ⇒ self
Alias to write_array_of(:int64,ints)
.
1488 1489 1490 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1488 def write_array_of_int64(ints) write_array_of(:int64,ints) end |
#write_array_of_int8(ints) ⇒ self
Alias to write_array_of(:int8,ints)
.
1440 1441 1442 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1440 def write_array_of_int8(ints) write_array_of(:int8,ints) end |
#write_array_of_long(ints) ⇒ self
Alias to write_array_of(:long,ints)
.
1602 1603 1604 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1602 def write_array_of_long(ints) write_array_of(:long,ints) end |
#write_array_of_long_long(ints) ⇒ self
Alias to write_array_of(:long_long,ints)
.
1618 1619 1620 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1618 def write_array_of_long_long(ints) write_array_of(:long_long,ints) end |
#write_array_of_short(ints) ⇒ self
Alias to write_array_of(:short,ints)
.
1568 1569 1570 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1568 def write_array_of_short(ints) write_array_of(:short,ints) end |
#write_array_of_uchar(chars) ⇒ self Also known as: write_uchars
Alias to write_array_of(:uchar,bytes)
.
1422 1423 1424 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1422 def write_array_of_uchar(chars) write_array_of(:uchar,chars) end |
#write_array_of_uint(uints) ⇒ self Also known as: write_uints
Alias to write_array_of(:uint,uints)
.
1650 1651 1652 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1650 def write_array_of_uint(uints) write_array_of(:uint,uints) end |
#write_array_of_uint16(uints) ⇒ self
Alias to write_array_of(:uint16,uints)
.
1520 1521 1522 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1520 def write_array_of_uint16(uints) write_array_of(:uint16,uints) end |
#write_array_of_uint32(uints) ⇒ self
Alias to write_array_of(:uint32,uints)
.
1536 1537 1538 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1536 def write_array_of_uint32(uints) write_array_of(:uint32,uints) end |
#write_array_of_uint64(uints) ⇒ self
Alias to write_array_of(:uint64,uints)
.
1552 1553 1554 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1552 def write_array_of_uint64(uints) write_array_of(:uint64,uints) end |
#write_array_of_uint8(uints) ⇒ self
Alias to write_array_of(:uint8,uints)
.
1504 1505 1506 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1504 def write_array_of_uint8(uints) write_array_of(:uint8,uints) end |
#write_array_of_ulong(uints) ⇒ self
Alias to write_array_of(:ulong,uints)
.
1668 1669 1670 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1668 def write_array_of_ulong(uints) write_array_of(:ulong,uints) end |
#write_array_of_ulong_long(uints) ⇒ self
Alias to write_array_of(:ulong_long,uints)
.
1684 1685 1686 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1684 def write_array_of_ulong_long(uints) write_array_of(:ulong_long,uints) end |
#write_array_of_ushort(uints) ⇒ self
Alias to write_array_of(:ushort,uints)
.
1634 1635 1636 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1634 def write_array_of_ushort(uints) write_array_of(:ushort,uints) end |
#write_byte(value) ⇒ self
Alias for write_value(:byte,value)
.
974 975 976 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 974 def write_byte(value) write_value(:byte,value) end |
#write_char(value) ⇒ self
Alias for write_value(:char,value)
.
990 991 992 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 990 def write_char(value) write_value(:char,value) end |
#write_double(value) ⇒ self
Alias for write_value(:double,value)
.
1348 1349 1350 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1348 def write_double(value) write_value(:double,value) end |
#write_float(value) ⇒ self
Alias for write_value(:float,value)
.
1332 1333 1334 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1332 def write_float(value) write_value(:float,value) end |
#write_float32(value) ⇒ self
Alias for write_value(:float32,value)
.
1300 1301 1302 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1300 def write_float32(value) write_value(:float32,value) end |
#write_float64(value) ⇒ self
Alias for write_value(:float64,value)
.
1316 1317 1318 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1316 def write_float64(value) write_value(:float64,value) end |
#write_int(value) ⇒ self
Alias for write_value(:int,value)
.
1188 1189 1190 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1188 def write_int(value) write_value(:int,value) end |
#write_int16(value) ⇒ self
Alias for write_value(:int16,value)
.
1060 1061 1062 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1060 def write_int16(value) write_value(:int16,value) end |
#write_int32(value) ⇒ self
Alias for write_value(:int32,value)
.
1076 1077 1078 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1076 def write_int32(value) write_value(:int32,value) end |
#write_int64(value) ⇒ self
Alias for write_value(:int64,value)
.
1092 1093 1094 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1092 def write_int64(value) write_value(:int64,value) end |
#write_int8(value) ⇒ self
Alias for write_value(:int8,value)
.
1044 1045 1046 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1044 def write_int8(value) write_value(:int8,value) end |
#write_long(value) ⇒ self
Alias for write_value(:long,value)
.
1204 1205 1206 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1204 def write_long(value) write_value(:long,value) end |
#write_long_long(value) ⇒ self
Alias for write_value(:long_long,value)
.
1220 1221 1222 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1220 def write_long_long(value) write_value(:long_long,value) end |
#write_short(value) ⇒ self
Alias for write_value(:short,value)
.
1172 1173 1174 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1172 def write_short(value) write_value(:short,value) end |
#write_string(string) ⇒ self
Writes a null-terminated C string to the buffer.
1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1004 def write_string(string) ascii_string = string.encode(Encoding::ASCII_8BIT) cstring = if ascii_string.end_with?("\0") ascii_string else "#{ascii_string}\0" end write(cstring) return self end |
#write_uchar(value) ⇒ self
Alias for write_value(:uchar,value)
.
1028 1029 1030 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1028 def write_uchar(value) write_value(:uchar,value) end |
#write_uint(value) ⇒ self
Alias for write_value(:uint,value)
.
1252 1253 1254 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1252 def write_uint(value) write_value(:uint,value) end |
#write_uint16(value) ⇒ self
Alias for write_value(:uint16,value)
.
1124 1125 1126 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1124 def write_uint16(value) write_value(:uint16,value) end |
#write_uint32(value) ⇒ self
Alias for write_value(:uint32,value)
.
1140 1141 1142 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1140 def write_uint32(value) write_value(:uint32,value) end |
#write_uint64(value) ⇒ self
Alias for write_value(:uint64,value)
.
1156 1157 1158 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1156 def write_uint64(value) write_value(:uint64,value) end |
#write_uint8(value) ⇒ self
Alias for write_value(:uint8,value)
.
1108 1109 1110 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1108 def write_uint8(value) write_value(:uint8,value) end |
#write_ulong(value) ⇒ self
Alias for write_value(:ulong,value)
.
1268 1269 1270 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1268 def write_ulong(value) write_value(:ulong,value) end |
#write_ulong_long(value) ⇒ self
Alias for write_value(:ulong_long,value)
.
1284 1285 1286 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1284 def write_ulong_long(value) write_value(:ulong_long,value) end |
#write_ushort(value) ⇒ self
Alias for write_value(:ushort,value)
.
1236 1237 1238 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 1236 def write_ushort(value) write_value(:ushort,value) end |
#write_value(type, value) ⇒ self
Writes the value to the IO stream.
954 955 956 957 958 959 960 |
# File 'lib/ronin/support/binary/stream/methods.rb', line 954 def write_value(type,value) type = type_system[type] data = type.pack(value) write(data) return self end |