lib/ionian/extension/io.rb in ionian-0.6.5 vs lib/ionian/extension/io.rb in ionian-0.6.6
- old
+ new
@@ -51,11 +51,14 @@
@ionian_expression = Regexp.new "(.*?)#{expression}" if exp.is_a? String
end
# Read all data in the buffer.
# An alternative to using #readpartial with a large length.
+ # Blocks until data is available.
def read_all
- data = ''
+ # Block until data has arrived.
+ data = readpartial 0xFFFF
+ # If there is more data in the buffer, retrieve it nonblocking.
data += readpartial 0xFFFF while has_data?
data
end
# Read matched data from the buffer.
\ No newline at end of file