Write all content to the supplied channel.

@param channel the channel to which the content is to be written.
@throws IOException if there is a problem writing to the supplied stream
490302
public void writeTo( WritableByteChannel channel ) throws IOException {
        int numberOfBytesToWrite = size;
        for (ByteBuffer buffer : buffers) {
            if (buffer == null) {
                // already flushed
                continue;
            }
            int numBytesInBuffer = Math.min(numberOfBytesToWrite, bufferSize);
            buffer.position(numBytesInBuffer);
            buffer.flip();
            channel.write(buffer);
            numberOfBytesToWrite -= numBytesInBuffer;
        }
        buffers.clear();
    }
224530
public void writeContent(final OutputStream result) throws IOException
    {
        if(this.document.getLastElementWritten() != null && !(this.document.getLastElementWritten() instanceof RtfChapter)) {
            result.write(DocWriter.getISOBytes("\\page"));
        }
        result.write(DocWriter.getISOBytes("\\sectd"));
        document.getDocumentHeader().writeSectionDefinition(result);
        if(this.title != null) {
            this.title.writeContent(result);
        }
        for(int i = 0; i < items.size(); i++) {
        	RtfBasicElement rbe = (RtfBasicElement)items.get(i);
        	rbe.writeContent(result);
        }
        result.write(DocWriter.getISOBytes("\\sect"));
    }
238846
public void writeTo(File file) throws IOException {
        FileChannel channel = new FileOutputStream(file).getChannel();
        try {
            writeTo(channel);
        } finally {
            channel.close();
        }
    }
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++;
    }
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);
    	}
    }
82436
public void writeContent(final OutputStream result) throws IOException
    {
        result.write(PARAGRAPH_DEFAULTS);
        result.write(PLAIN);
        if(inTable) {
            result.write(IN_TABLE);
        }
        if(this.lineLeading > 0) {
            result.write(LINE_SPACING);
            result.write(intToByteArray(this.lineLeading));
        }
        for(int i = 0; i < chunks.size(); i++) {
        	RtfBasicElement rbe = (RtfBasicElement) chunks.get(i);
        	rbe.writeContent(result);
        }
    }
1150480
public static final long write(WritableByteChannel channel, ByteBuffer[] srcs, int offset, int length) throws IOException
    {
        long res = 0;
        for  (int ii=0;ii<length;ii++)
        {
            ByteBuffer bb = srcs[ii+offset];
            if (bb.hasRemaining())
            {
                res += channel.write(bb);
                if (bb.hasRemaining())
                {
                    break;
                }
            }
        }
        return res;
    }
813643
public static void writeCompletely(WritableByteChannel channel, ByteBuffer src) throws IOException {
		while (src.hasRemaining()) {
			channel.write(src);
		}
	}
416437
@Override
    public void close() throws IOException
    {
        if (!isClosed)
        {
            flush();
            if (closeChannel)
            {
                channel.close();
            }
            isClosed = true;
        }
    }
471458
public void writeTo(final OutputStream out) throws IOException
    {
        for (int i = 0; i <= index; i++)
        {
            Block block = blocks.get(i);
            out.write(block.data, 0, block.limit);
        }
    }
1339289
public void write(byte b[], int off, int len)
        throws IOException
    {     
        len=prepareOutput(len);
        if (!_nulled)
            _out.write(b,off,len);
        if (_bytes==_contentLength)
            flush();
    }
450817
public void write(OutputStream out) throws IOException {
		for(HttpHeader header: this) {
			header.write(out);
		}
		out.write(CR);
		out.write(LF);
	}
1196802
public void write(byte[] bytes) throws IOException {
        for (int i = 0; i < bytes.length; i++) {
            write(bytes[i]);
        }
    }
1221866
public int write(WritableByteChannel channel) throws IOException {
        // header
        ByteBuffer header = ByteBuffer.allocate(HEADER_LENGTH);
        header.putInt(getSegmentId());
        header.putLong(getSegmentLastForcedTime());
        header.putInt(size());
        
        // footer
        ByteBuffer footer;
        try {
            MessageDigest m = MessageDigest.getInstance("MD5");
            m.reset();
            m.update(header.array());
            m.update(_buffer.array(), 0, _buffer.position());
            byte[] digest = ensure128BitMD5(m.digest());
            
            footer = ByteBuffer.allocate(MD5_LENGTH);
            footer.put(digest);
        } catch (NoSuchAlgorithmException e) {
            throw new IOException(e);
        }
        
        // Write header, data, footer
        header.flip();
        channel.write(header);
        
        channel.write(ByteBuffer.wrap(_buffer.array(), 0, _buffer.position()));
        
        footer.flip();
        channel.write(footer);
        
        return (_buffer.position() + HEADER_FOOTER_LENGTH);
    }
1312181
public void init(Channel channel, long writtenAmount) {
        if (channel == null) {
            throw new NullPointerException("channel");
        }
        if (writtenAmount <= 0) {
            throw new IllegalArgumentException(
                    "writtenAmount must be a positive integer: " + writtenAmount);
        }

        this.channel = channel;
        this.writtenAmount = writtenAmount;
    }
323720
public void write(Writer out)
         throws IOException
    {
        out.write('<'+tag+attributes()+'>');
        super.write(out);
        out.write("</"+tag+"\n>");
    }
21341
public void writeContent(final OutputStream result) throws IOException
    {
    	writeRowDefinition(result);
        
        for(int i = 0; i < this.cells.size(); i++) {
            RtfCell rtfCell = (RtfCell) this.cells.get(i);
            rtfCell.writeContent(result);
        }

        result.write(DELIMITER);

        if(this.document.getDocumentSettings().isOutputTableRowDefinitionAfter()) {
        	writeRowDefinition(result);
        }

        result.write(ROW_END);
        this.document.outputDebugLinebreak(result);
    }