Gets the contents of an InputStream as a byte[] . This method buffers the input internally, so there is no need to use a BufferedInputStream . @param input the InputStream to read from @return the requested byte array @throws NullPointerExceptio
(final InputStream input)
| 717 | * @throws IOException if an I/O error occurs |
| 718 | */ |
| 719 | public static byte[] toByteArray(final InputStream input) throws IOException { |
| 720 | final ByteArrayOutputStream output = new ByteArrayOutputStream(); |
| 721 | copy(input, output); |
| 722 | return output.toByteArray(); |
| 723 | } |
| 724 | |
| 725 | /** |
| 726 | * Gets contents of an <code>InputStream</code> as a <code>byte[]</code>. |