Class: HrrRbSftp::Receiver
- Inherits:
-
Object
- Object
- HrrRbSftp::Receiver
- Defined in:
- lib/hrr_rb_sftp/receiver.rb
Overview
This class implements payload receiver.
Instance Method Summary collapse
-
#initialize(io_in) ⇒ Receiver
constructor
Instantiates a new payload receiver for the input IO.
-
#receive ⇒ String?
Receives payload_length payload.
Constructor Details
#initialize(io_in) ⇒ Receiver
Instantiates a new payload receiver for the input IO.
13 14 15 |
# File 'lib/hrr_rb_sftp/receiver.rb', line 13 def initialize io_in @io_in = io_in end |
Instance Method Details
#receive ⇒ String?
Receives payload_length payload. When input IO is EOF, returns nil.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/hrr_rb_sftp/receiver.rb', line 22 def receive begin paylaod_length = Protocol::Common::DataTypes::Uint32.decode(@io_in) rescue NoMethodError nil else payload = @io_in.read(paylaod_length) if payload.nil? || payload.bytesize != paylaod_length nil else payload end end end |