/** * Copy chars from a <code>Reader</code> to a <code>Writer</code>. */ public static void copy(final Reader input, final Writer output) throws IOException { copy(input, output, DEFAULT_BUFFER_SIZE); }
/** * Copy bytes from an <code>InputStream</code> to an <code>OutputStream</code>. */ public static void copy(final InputStream input, final OutputStream output) throws IOException { copy(input, output, DEFAULT_BUFFER_SIZE); }
/** * Copy and convert bytes from an <code>InputStream</code> to chars on a <code>Writer</code>. * The platform's default encoding is used for the byte-to-char conversion. */ public static void copy(final InputStream input, final Writer output) throws IOException { copy(input, output, DEFAULT_BUFFER_SIZE); }
/** * Copy and convert bytes from an <code>InputStream</code> to chars on a <code>Writer</code>. * The platform's default encoding is used for the byte-to-char conversion. * * @param bufferSize Size of internal buffer to use. */ public static void copy(final InputStream input, final Writer output, final int bufferSize) throws IOException { final InputStreamReader in = new InputStreamReader(input); copy(in, output, bufferSize); }
/** * Copy and convert bytes from an <code>InputStream</code> to chars on a <code>Writer</code>, using the specified encoding. * * @param encoding The name of a supported character encoding. See the <a href="http://www.iana.org/assignments/character-sets">IANA Charset * Registry</a> for a list of valid encoding types. */ public static void copy(final InputStream input, final Writer output, final String encoding) throws IOException { final InputStreamReader in = new InputStreamReader(input, encoding); copy(in, output); }
/** * Copy and convert bytes from an <code>InputStream</code> to chars on a <code>Writer</code>, using the specified encoding. * * @param encoding The name of a supported character encoding. See the <a href="http://www.iana.org/assignments/character-sets">IANA Charset * Registry</a> for a list of valid encoding types. * @param bufferSize Size of internal buffer to use. */ public static void copy(final InputStream input, final Writer output, final String encoding, final int bufferSize) throws IOException { final InputStreamReader in = new InputStreamReader(input, encoding); copy(in, output, bufferSize); } }
public String getContent() throws IOException { URL url = getUrl(); if (url == null) { return null; } PrintBuffer buff = new PrintBuffer(); InputStream input = url.openStream(); try { Copier.copy(input, buff); } finally { Closer.close(input); } return buff.toString(); } }
Copier.copy(in, out);