aliocrlib/src/main/java/com/lib/aliocr/utils/io/IOUtils.java
/**
     * Get the contents of a <code>URLConnection</code> as a <code>byte[]</code>.
     *
     * @param urlConn the <code>URLConnection</code> to read
     * @return the requested byte array
     * @throws NullPointerException if the urlConn is null
     * @throws IOException          if an I/O exception occurs
     * @since 2.4
     */
Get the contents of a URLConnection as a byte[].
Get the contents of a URLConnection as a byte [] .
public static byte[] toByteArray(URLConnection urlConn) throws IOException {
        InputStream inputStream = urlConn.getInputStream();
        try {
            return IOUtils.toByteArray(inputStream);
        } catch (Exception e) {
             Log.e("", "");
        } finally {
            inputStream.close();
        }
        return new byte[0];
    }
public static byte [ ] toByteArray ( URLConnection urlConn ) throws IOException { InputStream inputStream = urlConn . getInputStream ( ) ; try { return IOUtils . toByteArray ( inputStream ) ; } catch ( Exception e ) { Log . e ( "" , "" ) ; } finally { inputStream . close ( ) ; } return new byte [ 0 ] ; }
Get the contents of a <code>URLConnection</code> as a <code>byte[]</code>.
Get the contents of a <code > URLConnection< / code > as a <code > byte [] < / code > .