Class: Sigma::ByteArray
- Inherits:
-
Object
- Object
- Sigma::ByteArray
- Extended by:
- FFI::Library
- Defined in:
- lib/sigma/byte_array.rb
Overview
Array of Bytes
Instance Attribute Summary collapse
-
#pointer ⇒ Object
Returns the value of attribute pointer.
Class Method Summary collapse
-
.from_bytes(bytes) ⇒ ByteArray
Create ByteArray of Array of unsigned 8-bit ints (bytes).
-
.with_raw_pointer(pointer) ⇒ ByteArray
Takes ownership of an existing ByteArray Pointer.
Instance Attribute Details
#pointer ⇒ Object
Returns the value of attribute pointer.
13 14 15 |
# File 'lib/sigma/byte_array.rb', line 13 def pointer @pointer end |
Class Method Details
.from_bytes(bytes) ⇒ ByteArray
Create ByteArray of Array of unsigned 8-bit ints (bytes)
18 19 20 21 22 23 24 25 |
# File 'lib/sigma/byte_array.rb', line 18 def self.from_bytes(bytes) pointer = FFI::MemoryPointer.new(:pointer) b_ptr = FFI::MemoryPointer.new(:uint8, bytes.size) b_ptr.write_array_of_uint8(bytes) error = ergo_lib_byte_array_from_raw_parts(b_ptr, bytes.size, pointer) Util.check_error!(error) init(pointer) end |
.with_raw_pointer(pointer) ⇒ ByteArray
Note:
A user of sigma_rb generally does not need to call this function
Takes ownership of an existing ByteArray Pointer.
31 32 33 |
# File 'lib/sigma/byte_array.rb', line 31 def self.with_raw_pointer(pointer) init(pointer) end |