Writes the current content to the passed buffer. The copied elements are
removed from this streams buffer.

@param aBuf
The buffer to be filled. May not be <code>null</code>.
322221
public void writeTo (@Nonnull final byte [] aBuf)
  {
    ValueEnforcer.notNull (aBuf, "Buffer");

    writeTo (aBuf, 0, aBuf.length, true);
  }
1189610
@Override
  public void write (@Nonnull final char [] aBuf, @Nonnegative final int nOfs, @Nonnegative final int nLen)
  {
    ValueEnforcer.isArrayOfsLen (aBuf, nOfs, nLen);
    if (nLen > 0)
      m_aSB.append (aBuf, nOfs, nLen);
  }
143054
public static ByteBuffer copyBuffer(final ByteBuffer buf) {
        if(buf == null)
            return null;
        int offset=buf.hasArray()? buf.arrayOffset() + buf.position() : buf.position(), len=buf.remaining();
        byte[] tmp=new byte[len];
        if(!buf.isDirect())
            System.arraycopy(buf.array(), offset, tmp, 0, len);
        else {
         //   buf.get(tmp, 0, len);
            for(int i=0; i < len; i++)
                tmp[i]=buf.get(i+offset);
        }
        return ByteBuffer.wrap(tmp);
    }
340550
public void write(byte []buf, int offset, int length, boolean isEnd)
    throws IOException
  {
    if (_stream != null)
      _stream.write(buf, offset, length, isEnd);
  }
976193
public function write($buf)
    {
        $this->wBuf_ .= $buf;
        if (TStringFuncFactory::create()->strlen($this->wBuf_) >= $this->wBufSize_) {
            $out = $this->wBuf_;

            // Note that we clear the internal wBuf_ prior to the underlying write
            // to ensure we're in a sane state (i.e. internal buffer cleaned)
            // if the underlying write throws up an exception
            $this->wBuf_ = '';
            $this->transport_->write($out);
        }
    }
918871
@Override
  public void write(byte []buf, int offset, int length, boolean isEnd)
    throws IOException
  {
    if (buf == null)
      throw new NullPointerException();
    else if (offset < 0 || buf.length < offset + length)
      throw new ArrayIndexOutOfBoundsException();

    nativeWrite(_fd, buf, offset, length);
  }
875323
@Override
  public void write (final int c) throws IOException
  {
    _ensureOpen ();
    if (m_nNextChar >= m_nChars)
      flushBuffer ();
    m_aBuf[m_nNextChar++] = (char) c;
  }
331136
@Override
    public void write(int b) throws IOException {
        if (this.isClosed) {
            throw new IOException("OutputStream is closed.");
        }

        if (this.position >= this.length) {
            throw new IOException("Buffer capacity exceeded.");
        }

        this.array[this.offset + this.position] = (byte) b;
        this.position++;
    }
789623
public void writeByteBufferPart(byte[] buffer, int offset, int length)
        throws IOException
    {
        while (length > 0) {
            flushIfFull();

            int sublen = _buffer.length - _offset;

            if (length < sublen)
                sublen = length;

            _buffer[_offset++] = BC_BINARY_CHUNK;
            _buffer[_offset++] = (byte) (sublen >> 8);
            _buffer[_offset++] = (byte) sublen;

            System.arraycopy(buffer, offset, _buffer, _offset, sublen);

            _offset += sublen;
            length -= sublen;
            offset += sublen;
        }
    }
440205
public void write(final int b)
	{
		buffer[pos] = (byte)b;
		size++;
		if(++pos == buffer.length) flushBuffer();
	}
1039985
public void writeContent(final OutputStream result) throws IOException
    {
    	for(int i = 0; i < this.tabs.size(); i++) {
    		RtfTab rt = (RtfTab) this.tabs.get(i);
    		rt.writeContent(result);
    	}
    }
979318
@Override
  public void write(int v)
    throws IOException
  {
    _buf[0] = (byte) v;
    
    _stream.write(_buf, 0, 1, false);
  }
1171711
@Override
    public void write(int value) throws IOException {
        validate();
        byte[] buf = new byte[1];
        buf[0] = (byte) value;
        writeToBuffers(buf, 0, 1);

    }
685502
@Override
    public void write(char cbuf[], int off, int len) {
        buf.append(cbuf, off, len);
    }
751787
public int readN(final byte[] abuf, final int off, final int len)
            throws OtpErlangDecodeException {
        if (len == 0 && available() == 0) {
            return 0;
        }
        final int i = super.read(abuf, off, len);
        if (i < 0) {
            throw new OtpErlangDecodeException("Cannot read from input stream");
        }
        return i;
    }
807818
public void write(final int b) {
        Holder<T> log = getOrReset();
        if (b == '\n') {
            flushEventBuffer();
        } else if (b == '\r') {
            log.setCrchar(true);
        } else {
            if (log.isCrchar()) {
                flushEventBuffer();
                resetEventBuffer();
            }
            log.getBuffer().write((byte) b);
        }

    }
1364150
private int _read1 (@Nonnull final byte [] aBuf,
                      @Nonnegative final int nOfs,
                      @Nonnegative final int nLen) throws IOException
  {
    int nAvail = m_nCount - m_nPos;
    if (nAvail <= 0)
    {
      /*
       * If the requested length is at least as large as the buffer, and if
       * there is no mark/reset activity, do not bother to copy the bytes into
       * the local buffer. In this way buffered streams will cascade harmlessly.
       */
      if (nLen >= _getBufIfOpen ().length && m_nMarkPos < 0)
      {
        // Potentially blocking read
        return _getInIfOpen ().read (aBuf, nOfs, nLen);
      }

      _fill ();
      nAvail = m_nCount - m_nPos;
      if (nAvail <= 0)
        return -1;
    }
    final int nCnt = nAvail < nLen ? nAvail : nLen;
    System.arraycopy (_getBufIfOpen (), m_nPos, aBuf, nOfs, nCnt);
    m_nPos += nCnt;
    return nCnt;
  }