@SuppressWarnings("PMD.AssignmentInOperand")
    private static byte[] asBytes(final InputStream input) throws IOException {
        input.reset();
        try (ByteArrayOutputStream output = new ByteArrayOutputStream()) {
            // @checkstyle MagicNumberCheck (1 line)
            final byte[] buffer = new byte[1024];
            int read;
            while ((read = input.read(buffer, 0, buffer.length)) != -1) {
                output.write(buffer, 0, read);
            }
            output.flush();
            return output.toByteArray();
        }
    }
@ SuppressWarnings ( "PMD.AssignmentInOperand" ) private static byte [ ] asBytes ( final InputStream input ) throws IOException { input . reset ( ) ; try ( ByteArrayOutputStream output = new ByteArrayOutputStream ( ) ) { final byte [ ] buffer = new byte [ 1024 ] ; int read ; while ( ( read = input . read ( buffer , 0 , buffer . length ) ) != - 1 ) { output . write ( buffer , 0 , read ) ; } output . flush ( ) ; return output . toByteArray ( ) ; } }
InputStream as bytes.
@param input Input
@return Bytes
@throws IOException If some problem inside