# File lib/protocols/line_and_text.rb, line 96
 96:       def set_binary_mode size = nil
 97:         if @lbp_mode == :lines
 98:           if size == 0
 99:             receive_binary_data("") if respond_to?(:receive_binary_data)
100:             # Do no more work here. Stay in line mode and keep consuming data.
101:           else
102:             @lbp_binary_limit = size.to_i # (nil will be stored as zero)
103:             if @lbp_binary_limit > 0
104:               raise "Overlength" if @lbp_binary_limit > MaxBinaryLength # arbitrary sanity check
105:               @lbp_binary_buffer = "\0" * @lbp_binary_limit
106:               @lbp_binary_bytes_received = 0
107:             end
108: 
109:             @lbp_mode = :binary
110:             receive_data @lpb_buffer.flush
111:           end
112:         else
113:           raise "invalid operation"
114:         end
115:       end