Class: IO
- Inherits:
-
Object
- Object
- IO
- Defined in:
- lib/postgres-pr/message.rb
Instance Method Summary collapse
Instance Method Details
#read_exactly_n_bytes(n) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/postgres-pr/message.rb', line 10 def read_exactly_n_bytes(n) buf = read(n) raise EOFError if buf == nil return buf if buf.size == n n -= buf.size while n > 0 str = read(n) raise EOFError if str == nil buf << str n -= str.size end return buf end |