Method: SSHData::Encoding#decode_n_strings

Defined in:
lib/ssh_data/encoding.rb

#decode_n_strings(raw, offset = 0, n) ⇒ Object

Read the specified number of strings out of the provided raw data.

raw - A binary String. offset - The offset into raw at which to read (default 0). n - The Integer number of Strings to read.

Returns an Array including the Array of decoded Strings and the Integer number of bytes read.



596
597
598
599
600
601
602
603
604
605
606
# File 'lib/ssh_data/encoding.rb', line 596

def decode_n_strings(raw, offset=0, n)
  total_read = 0
  strs = []

  n.times do |i|
    strs[i], read = decode_string(raw, offset + total_read)
    total_read += read
  end

  [strs, total_read]
end