Class: SshTresor::SSHEncoding::Reader Private
- Inherits:
-
Object
- Object
- SshTresor::SSHEncoding::Reader
- Defined in:
- lib/ssh_tresor/ssh_encoding.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Sequential reader for SSH wire values.
Instance Method Summary collapse
-
#byte ⇒ Integer
private
Next byte value.
-
#eof? ⇒ Boolean
private
Whether the reader consumed all input.
-
#initialize(data) ⇒ Reader
constructor
private
A new instance of Reader.
-
#string ⇒ String
private
Next SSH length-prefixed string.
-
#uint32 ⇒ Integer
private
Next unsigned 32-bit integer.
Constructor Details
#initialize(data) ⇒ Reader
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Reader.
37 38 39 40 |
# File 'lib/ssh_tresor/ssh_encoding.rb', line 37 def initialize(data) @data = data.b @offset = 0 end |
Instance Method Details
#byte ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns next byte value.
43 44 45 |
# File 'lib/ssh_tresor/ssh_encoding.rb', line 43 def byte read(1).getbyte(0) end |
#eof? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns whether the reader consumed all input.
59 60 61 |
# File 'lib/ssh_tresor/ssh_encoding.rb', line 59 def eof? @offset == @data.bytesize end |
#string ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns next SSH length-prefixed string.
53 54 55 56 |
# File 'lib/ssh_tresor/ssh_encoding.rb', line 53 def string length = uint32 read(length) end |
#uint32 ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns next unsigned 32-bit integer.
48 49 50 |
# File 'lib/ssh_tresor/ssh_encoding.rb', line 48 def uint32 read(4).unpack1("N") end |