code: public void write(InputStream is, boolean escape, boolean noBackslashEscapes) throws IOException {
      byte[] array = new byte[4096];
      int len;
      if (escape) {
        while ((len = is.read(array)) > 0) {
          writeBytesEscaped(array, len, noBackslashEscapes);
        }
      } else {
        while ((len = is.read(array)) > 0) {
          write(array, 0, len);
        }
      }
    }
docs: Write stream into socket.
  
  @param is                 inputStream
  @param escape             must be escape
  @param noBackslashEscapes escape method
  @throws IOException if socket error occur