class DBus::Data::String

UTF-8 encoded string.

Public Class Methods

alignment() click to toggle source
    # File lib/dbus/data.rb
421 def self.alignment
422   4
423 end
from_raw(value, mode:) click to toggle source
    # File lib/dbus/data.rb
437 def self.from_raw(value, mode:)
438   value.force_encoding(Encoding::UTF_8)
439   if mode == :plain
440     validate_raw!(value)
441     return value
442   end
443 
444   new(value)
445 end
size_class() click to toggle source
    # File lib/dbus/data.rb
425 def self.size_class
426   UInt32
427 end
type_code() click to toggle source
    # File lib/dbus/data.rb
417 def self.type_code
418   "s"
419 end
validate_raw!(value) click to toggle source
    # File lib/dbus/data.rb
429 def self.validate_raw!(value)
430   value.each_codepoint do |cp|
431     raise InvalidPacketException, "Invalid string, contains NUL" if cp.zero?
432   end
433 rescue ArgumentError
434   raise InvalidPacketException, "Invalid string, not in UTF-8"
435 end