Class: Net::FTP::BufferedSocket

Inherits:
BufferedIO
  • Object
show all
Defined in:
lib/net/ftp.rb

Direct Known Subclasses

BufferedSSLSocket

Instance Method Summary collapse

Instance Method Details

#getsObject



1530
1531
1532
1533
# File 'lib/net/ftp.rb', line 1530

def gets
  line = readuntil("\n", true)
  return line.empty? ? nil : line
end

#read(len = nil) ⇒ Object



1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
# File 'lib/net/ftp.rb', line 1516

def read(len = nil)
  if len
    s = super(len, String.new, true)
    return s.empty? ? nil : s
  else
    result = String.new
    while s = super(DEFAULT_BLOCKSIZE, String.new, true)
      break if s.empty?
      result << s
    end
    return result
  end
end

#readlineObject



1535
1536
1537
1538
1539
1540
1541
# File 'lib/net/ftp.rb', line 1535

def readline
  line = gets
  if line.nil?
    raise EOFError, "end of file reached"
  end
  return line
end