Class: String

Inherits:
Object
  • Object
show all
Includes:
Net::BER::BERParser
Defined in:
lib/net/ber.rb,
lib/net/ber.rb

Direct Known Subclasses

Net::BER::BerIdentifiedString

Constant Summary

Constants included from Net::BER::BERParser

Net::BER::BERParser::BuiltinSyntax, Net::BER::BERParser::TagClasses

Instance Method Summary collapse

Methods included from Net::BER::BERParser

#read_ber_from_string

Instance Method Details

#read_ber(syntax = nil) ⇒ Object



361
362
363
# File 'lib/net/ber.rb', line 361

def read_ber syntax=nil
  StringIO.new(self).read_ber(syntax)
end

#read_ber!(syntax = nil) ⇒ Object



365
366
367
368
369
370
371
372
373
# File 'lib/net/ber.rb', line 365

def read_ber! syntax=nil
  obj,n_consumed = read_ber_from_string(self, syntax)
  if n_consumed
    self.slice!(0...n_consumed)
    obj
  else
    nil
  end
end

#to_ber(code = 4) ⇒ Object

to_ber A universal octet-string is tag number 4, but others are possible depending on the context, so we let the caller give us one. The preferred way to do this in user code is via to_ber_application_sring and to_ber_contextspecific.



497
498
499
# File 'lib/net/ber.rb', line 497

def to_ber code = 4
  [code].pack('C') + length.to_ber_length_encoding + self
end

#to_ber_application_string(code) ⇒ Object

to_ber_application_string



504
505
506
# File 'lib/net/ber.rb', line 504

def to_ber_application_string code
  to_ber( 0x40 + code )
end

#to_ber_contextspecific(code) ⇒ Object

to_ber_contextspecific



511
512
513
# File 'lib/net/ber.rb', line 511

def to_ber_contextspecific code
  to_ber( 0x80 + code )
end