/** * Get the contents of an <code>InputStream</code> as a character array using the default * character encoding of the platform. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedInputStream</code>. * * @param is * the <code>InputStream</code> to read from * @return the requested character array * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static char[] toCharArray(InputStream is) throws IOException { CharArrayWriter output = new CharArrayWriter(); copy(is, output); return output.toCharArray(); }
/** * Get the contents of an <code>InputStream</code> as a character array using the default * character encoding of the platform. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedInputStream</code>. * * @param is * the <code>InputStream</code> to read from * @return the requested character array * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static char[] toCharArray(InputStream is) throws IOException { CharArrayWriter output = new CharArrayWriter(); copy(is, output); return output.toCharArray(); }
/** * Get the contents of an <code>InputStream</code> as a String using the default character * encoding of the platform. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedInputStream</code>. * * @param input * the <code>InputStream</code> to read from * @return the requested String * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static String toString(InputStream input) throws IOException { StringWriter sw = new StringWriter(); copy(input, sw); return sw.toString(); }
/** * Get the contents of a <code>Reader</code> as a character array. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedReader</code>. * * @param input * the <code>Reader</code> to read from * @return the requested character array * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static char[] toCharArray(final Reader input) throws IOException { CharArrayWriter sw = new CharArrayWriter(); copy(input, sw); return sw.toCharArray(); }
/** * Get the contents of a <code>Reader</code> as a String. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedReader</code>. * * @param input * the <code>Reader</code> to read from * @return the requested String * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static String toString(final Reader input) throws IOException { StringWriter sw = new StringWriter(); copy(input, sw); return sw.toString(); }
/** * Get the contents of a <code>Reader</code> as a character array. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedReader</code>. * * @param input * the <code>Reader</code> to read from * @return the requested character array * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static char[] toCharArray(Reader input) throws IOException { CharArrayWriter sw = new CharArrayWriter(); copy(input, sw); return sw.toCharArray(); }
/** * Get the contents of a <code>Reader</code> as a String. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedReader</code>. * * @param input * the <code>Reader</code> to read from * @return the requested String * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static String toString(Reader input) throws IOException { StringWriter sw = new StringWriter(); copy(input, sw); return sw.toString(); }
/** * Get the contents of a <code>Reader</code> as a character array. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedReader</code>. * * @param input * the <code>Reader</code> to read from * @return the requested character array * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static char[] toCharArray(Reader input) throws IOException { CharArrayWriter sw = new CharArrayWriter(); copy(input, sw); return sw.toCharArray(); }
/** * Get the contents of a <code>Reader</code> as a String. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedReader</code>. * * @param input * the <code>Reader</code> to read from * @return the requested String * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static String toString(Reader input) throws IOException { StringWriter sw = new StringWriter(); copy(input, sw); return sw.toString(); }
/** * Get the contents of an <code>InputStream</code> as a String using the default character * encoding of the platform. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedInputStream</code>. * * @param input * the <code>InputStream</code> to read from * @return the requested String * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static String toString(final InputStream input) throws IOException { StringWriter sw = new StringWriter(); copy(input, sw); return sw.toString(); }
/** * Get the contents of an <code>InputStream</code> as a String using the default character * encoding of the platform. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedInputStream</code>. * * @param input * the <code>InputStream</code> to read from * @return the requested String * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static String toString(InputStream input) throws IOException { StringWriter sw = new StringWriter(); copy(input, sw); return sw.toString(); }
/** * Get the contents of an <code>InputStream</code> as a character array using the default * character encoding of the platform. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedInputStream</code>. * * @param is * the <code>InputStream</code> to read from * @return the requested character array * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static char[] toCharArray(final InputStream is) throws IOException { CharArrayWriter output = new CharArrayWriter(); copy(is, output); return output.toCharArray(); }
/** * Get the contents of an <code>InputStream</code> as a <code>byte[]</code>. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedInputStream</code>. * * @param input * the <code>InputStream</code> to read from * @return the requested byte array * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static byte[] toByteArray(InputStream input) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(input, output); return output.toByteArray(); }
/** * Get the contents of an <code>InputStream</code> as a <code>byte[]</code>. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedInputStream</code>. * * @param input * the <code>InputStream</code> to read from * @return the requested byte array * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static byte[] toByteArray(InputStream input) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(input, output); return output.toByteArray(); }
/** * Get the contents of a <code>Reader</code> as a <code>byte[]</code> using the default * character encoding of the platform. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedReader</code>. * * @param input * the <code>Reader</code> to read from * @return the requested byte array * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static byte[] toByteArray(final Reader input) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(input, output); return output.toByteArray(); }
/** * Get the contents of a <code>Reader</code> as a <code>byte[]</code> using the default * character encoding of the platform. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedReader</code>. * * @param input * the <code>Reader</code> to read from * @return the requested byte array * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static byte[] toByteArray(Reader input) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(input, output); return output.toByteArray(); }
/** * Get the contents of an <code>InputStream</code> as a <code>byte[]</code>. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedInputStream</code>. * * @param input * the <code>InputStream</code> to read from * @return the requested byte array * @throws NullPointerException * if the input is null * @throws IOException * if an I/O error occurs */ public static byte[] toByteArray(final InputStream input) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(input, output); return output.toByteArray(); }
protected byte[] readAllResources(List<IResourceStream> resources) throws IOException, ResourceStreamNotFoundException { ByteArrayOutputStream output = new ByteArrayOutputStream(); for (IResourceStream curStream : resources) IOUtils.copy(curStream.getInputStream(), output); byte[] bytes = output.toByteArray(); if (getCompressor() != null) { String nonCompressed = new String(bytes, "UTF-8"); bytes = getCompressor().compress(nonCompressed).getBytes("UTF-8"); } return bytes; }
protected byte[] readAllResources(List<IResourceStream> resources) throws IOException, ResourceStreamNotFoundException { ByteArrayOutputStream output = new ByteArrayOutputStream(); for (IResourceStream curStream : resources) IOUtils.copy(curStream.getInputStream(), output); byte[] bytes = output.toByteArray(); if (getCompressor() != null) { String nonCompressed = new String(bytes, "UTF-8"); bytes = getCompressor().compress(nonCompressed).getBytes("UTF-8"); } return bytes; }
@Override protected byte[] readAllResources(List<IResourceStream> resources) throws IOException, ResourceStreamNotFoundException { ByteArrayOutputStream output = new ByteArrayOutputStream(); for (IResourceStream curStream : resources) { IOUtils.copy(curStream.getInputStream(), output); output.write(";".getBytes()); } byte[] bytes = output.toByteArray(); if (getCompressor() != null) { String nonCompressed = new String(bytes, "UTF-8"); bytes = getCompressor().compress(nonCompressed).getBytes("UTF-8"); } return bytes; }