'`BaseIOStream` constructor.
:arg io_loop: The `.IOLoop` to use; defaults to `.IOLoop.current`.
Deprecated since Tornado 4.1.
:arg max_buffer_size: Maximum amount of incoming data to buffer;
defaults to 100MB.
:arg read_chunk_size: Amount of data to read at one time from the
underlying transport; defaults to 64KB.
:arg max_write_buffer_size: Amount of outgoing data to buffer;
defaults to unlimited.
.. versionchanged:: 4.0
Add the ``max_write_buffer_size`` parameter.  Changed default
``read_chunk_size`` to 64KB.'

def __init__(self, io_loop=None, max_buffer_size=None, read_chunk_size=None, max_write_buffer_size=None):

    self.io_loop = (io_loop or ioloop.IOLoop.current())
    self.max_buffer_size = (max_buffer_size or 104857600)
    self.read_chunk_size = min((read_chunk_size or 65536), (self.max_buffer_size // 2))
    self.max_write_buffer_size = max_write_buffer_size
    self.error = None
    self._read_buffer = bytearray()
    self._read_buffer_pos = 0
    self._read_buffer_size = 0
    self._write_buffer = bytearray()
    self._write_buffer_pos = 0
    self._write_buffer_size = 0
    self._write_buffer_frozen = False
    self._total_write_index = 0
    self._total_write_done_index = 0
    self._pending_writes_while_frozen = []
    self._read_delimiter = None
    self._read_regex = None
    self._read_max_bytes = None
    self._read_bytes = None
    self._read_partial = False
    self._read_until_close = False
    self._read_callback = None
    self._read_future = None
    self._streaming_callback = None
    self._write_callback = None
    self._write_futures = collections.deque()
    self._close_callback = None
    self._connect_callback = None
    self._connect_future = None
    self._ssl_connect_future = None
    self._connecting = False
    self._state = None
    self._pending_callbacks = 0
    self._closed = False
