Writes all the contents of a Reader to a Writer.

@param reader
the reader to read from
@param writer
the writer to write to
@throws java.io.IOException
if an IOExcption occurs
557239
public static void copy(Reader reader, Writer writer) throws IOException {
		copy(reader, writer, false);
	}
1014570
@Override
    public int write(final ByteBuffer source) throws IOException {

        // Precondition checks
        this.checkClosed();
        if (source == null) {
            throw new IllegalArgumentException("Source buffer must be supplied");
        }

        // Put the bytes to be written into a byte[]
        final int totalBytes = source.remaining();
        final byte[] readContents = new byte[totalBytes];
        source.get(readContents);

        // Sync up, we're gonna access shared mutable state
        synchronized (this) {

            // Append the read contents to our internal contents
            this.contents = this.concat(this.contents, readContents, this.position);

            // Increment the position of this channel
            this.position += totalBytes;

        }

        // Return the number of bytes read
        return totalBytes;
    }
169704
public void save(Writer writer) throws IOException {
        BufferedWriter bufferWriter = new BufferedWriter(writer);
        writePrefixDeclaration(bufferWriter);
        writeMappingDeclaration(bufferWriter);
        bufferWriter.flush();
        bufferWriter.close();
    }
1999
public static void readAndWriteStreams(InputStream inputStream,OutputStream outputStream) throws IOException
    {
        byte[] buffer=new byte[5000];
        int read=-1;
        try
        {
            do
            {
                //read next buffer
                read=inputStream.read(buffer);
                
                if(read!=-1)
                {
                    //write to in memory stream
                    outputStream.write(buffer,0,read);
                }
            }while(read!=-1);
        }
        finally
        {
            //close streams
            IOHelper.closeResource(inputStream);
            IOHelper.closeResource(outputStream);
        }
    }
362304
public static final void copy(Reader reader, Writer writer, boolean closeReader, boolean closeWriter) throws IOException {
	try {
	    copy(reader, writer, 0xffff, -1);
	}
	finally {
	    if (closeReader) closeEL(reader);
	    if (closeWriter) closeEL(writer);
	}
    }
1367636
public static void copy(Reader in, Writer out) throws IOException {
    char[] buf = new char[1024];
    while (true) {
      int count = in.read(buf);
      if (count < 0) {
        break;
      }
      out.write(buf, 0, count);
    }
    out.flush();
  }
626294
public void write(Writer out)
         throws IOException
    {
        for (int i=0; i <elements.size() ; i++)
        {
            Object element = elements.get(i);
          
            if (element instanceof Element)
                ((Element)element).write(out);
            else if (element==null)
                out.write("null");
            else 
                out.write(element.toString());
        }
    }
685052
public static void writeLine(BufferedWriter writer, String line) throws IOException {
        writer.write(line);
        writer.newLine();
    }
1105887
public static void copy(Reader reader, OutputStream out) throws IOException {
    copy(reader, getOutputStreamWriter(out));
    out.flush();
  }
1363364
@Override
  public void write(int b) throws IOException
  {
    if(!bytesBuffer.hasRemaining()) {
      processBytesBuffer(false);
    }
    bytesBuffer.put((byte)b);
  }
1265577
public void write(File file) throws IOException {
        try (InputStream inputStream = getInputStream()) {
            IoUtils.copy(inputStream, file);
        }
    }
813341
public Writer writeTo(final Writer out) throws IOException {
        final Iterator iter = nodeIterator();
        while (iter.hasNext()) {
            ((Node) iter.next()).writeTo(out);
        }
        return out;
    }
1143999
public static void copy(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
        copy(reader, writer, false, false);
    }
444218
public void writeTo(final OutputStream outputStream) throws IOException {
        outputStream.write(getSigningKey());
        outputStream.write(getEncryptionKey());
    }
371783
@Override
  public void write(int b) throws IOException {
    if (!writtenHeader) {
      writeHeader();
      writtenHeader = true;
    }
    cipherStream.write(b);
  }
10489
@Override
	public void write(final OutputStream output) throws IOException
	{
		initialize();
		if (content == null)
		{
			content = new byte[0];
		}
		output.write(content, 0, content.length);
		output.flush();
	}
8420
public void write(Writer out)
         throws IOException
    {
        writeHtmlHead(out);
        writeBodyTag(out);
        writeElements(out);
        writeHtmlEnd(out);
    }