Class | Thrift::BaseTransport |
In: |
lib/thrift/transport/base_transport.rb
lib/thrift/transport/base_transport.rb |
Parent: | Object |
Reads a number of bytes from the transports. In Ruby 1.9+, the String returned will have a BINARY (aka ASCII8BIT) encoding.
sz - The number of bytes to read from the transport.
Returns a String acting as a byte buffer.
# File lib/thrift/transport/base_transport.rb, line 61 61: def read(sz) 62: raise NotImplementedError 63: end
Reads a number of bytes from the transports. In Ruby 1.9+, the String returned will have a BINARY (aka ASCII8BIT) encoding.
sz - The number of bytes to read from the transport.
Returns a String acting as a byte buffer.
# File lib/thrift/transport/base_transport.rb, line 61 61: def read(sz) 62: raise NotImplementedError 63: end
# File lib/thrift/transport/base_transport.rb, line 82 82: def read_all(size) 83: return Bytes.empty_byte_buffer if size <= 0 84: buf = read(size) 85: while (buf.length < size) 86: chunk = read(size - buf.length) 87: buf << chunk 88: end 89: 90: buf 91: end
# File lib/thrift/transport/base_transport.rb, line 82 82: def read_all(size) 83: return Bytes.empty_byte_buffer if size <= 0 84: buf = read(size) 85: while (buf.length < size) 86: chunk = read(size - buf.length) 87: buf << chunk 88: end 89: 90: buf 91: end
Writes the byte buffer to the transport. In Ruby 1.9+, the buffer will be forced into BINARY encoding.
buf - A String acting as a byte buffer.
Returns nothing.
# File lib/thrift/transport/base_transport.rb, line 98 98: def write(buf); end