Opens a write stream using this StringWriter as the resulting string
192536
public WriteStreamOld openWrite()
  {
    if (_cb != null)
      _cb.clear();
    else
      _cb = CharBuffer.allocate();

    if (_ws == null)
      _ws = new WriteStreamOld(this);
    else
      _ws.init(this);

    try {
      _ws.setEncoding("utf-8");
    } catch (UnsupportedEncodingException e) {
    }

    return _ws;
  }
964775
def write_string(string, data: nil, stream: nil)
      raise ArgumentError, "String must be present" if !string

      intbuf = write_varint(string.bytesize, data: data, stream: stream)

      stringbuf = BTC::Data.ensure_binary_encoding(string)

      data << stringbuf if data
      stream.write(stringbuf) if stream

      intbuf + stringbuf
    end
1205325
private void writeToImpl(Writer out, String encoding, byte[] bufferToWrite, int bufferToWriteLen)
            throws IOException {
        String writeStr;
        if (encoding != null) {
            writeStr = new String(bufferToWrite, 0, bufferToWriteLen, encoding);
        } else {
            writeStr = new String(bufferToWrite, 0, bufferToWriteLen);
        }
        out.write(writeStr);
    }
681846
def _write_str(self, data):
        
        with self.__lock:
            self.output.write(
                to_str(data, self.encoding)
                .encode()
                .decode(self.out_encoding, errors="replace")
            )
587047
public function OpenWriter() {
        $filePath = $this->destinationDir . $this->fileName;
        $this->writer = fopen($filePath, 'w') or die("can't open file $filePath.");
    }
640751
public static void writeToOutputStream(String s, OutputStream output) throws IOException {
		writeToOutputStream(s, output, null);
	}
270960
def to_string_io
      content = StringIO.new
      while bytes = read and !bytes.empty?
        content.write( bytes )
      end
      content.rewind
      content
    end
314245
def write(self, stream):
        '''
        

        '''
        (must_close, stream) = _open_stream(stream, 'write')
        try:
            stream.write(self.header.encode('ascii'))
            stream.write(b'\n')
            for elt in self:
                elt._write(stream, self.text, self.byte_order)
        finally:
            if must_close:
                stream.close()
635353
def write(fname, data):
		
		try:
			with open(fname, 'w') as f:
				json.dump(data, f)

		except IOError:
			raise Exception('Could not open {0!s} for writing'.format((fname)))
282504
public void write(ByteCodeWriter out)
    throws IOException
  {
    out.writeUTF8Const(getName());

    TempOutputStream ts = new TempOutputStream();
    //ts.openWrite();
    //WriteStream ws = new WriteStream(ts);
    ByteCodeWriter o2 = new ByteCodeWriter(ts, out.getJavaClass());

    o2.writeShort(_exceptions.size());
    for (int i = 0; i < _exceptions.size(); i++) {
      String exn = _exceptions.get(i);

      o2.writeClass(exn);
    }
    
    ts.close();
    
    out.writeInt(ts.getLength());
    
    TempBuffer ptr = ts.getHead();

    for (; ptr != null; ptr = ptr.next())
      out.write(ptr.buffer(), 0, ptr.length());

    ts.destroy();
  }
384116
def write(self, *args, **kwargs):
        
        return self.stream.write(ending="", *args, **kwargs)
366638
public ReadWritePair openReadWrite(boolean isAutoFlush) throws IOException
  {
    clearStatusCache();

    StreamImpl impl = openReadWriteImpl();
    //impl.setPath(this);

    WriteStreamOld writeStream = new WriteStreamOld(impl);
    ReadStreamOld readStream;

    if (isAutoFlush)
      readStream = new ReadStreamOld(impl);
    else
      readStream = new ReadStreamOld(impl);

    return new ReadWritePair(readStream, writeStream);
  }
277356
def write(self, file_or_filename, prog=None, format='xdot'):
        
        if prog is None:
            file = super(DotWriter, self).write(file_or_filename)
        else:
            buf = StringIO.StringIO()
            super(DotWriter, self).write(buf)
            buf.seek(0)
            data = self.create(buf.getvalue(), prog, format)

            if isinstance(file_or_filename, basestring):
                file = None
                try:
                    file = open(file_or_filename, "wb")
                except:
                    logger.error("Error opening %s." % file_or_filename)
                finally:
                    if file is not None:
                        file.write(data)
                        file.close()
            else:
                file = file_or_filename
                file.write(data)

        return file
948729
protected Writer openWriter(GenerationContext context) {
    Charset charset = Charset.forName(context.getEncoding());
    return new BufferedWriter(
        new OutputStreamWriter(createFileOutputStream(context.getFile()), charset));
  }
237994
def write(str)
      while !str.empty?
        pre,mid,str = str.partition("\n")
        write_str(pre) unless pre.empty?
        writeln unless mid.empty?
      end
    end
958149
def write(self, writer: WriteStream) -> None:
        
        for part in self._raw:
            writer.write(bytes(part))
736192
public void openStream() throws IOException {
        socket = new Socket(host, port);
        socketStream = socket.getOutputStream();
        if (null != context.get("name") && null != context.get("id")) {
            Object group = context.get("group");
            String desc = (null != group ? group + "/" : "") + context.get("name");
            write("Job started: " + desc + ": " + context.get("id"));
        }
        write("Execution: " + context.get("execid"));
    }