public static byte [ ] getBytesFromHttp ( String httpFileURL ) throws IOException { InputStream bufferedInputStream = null ; try { bufferedInputStream = getInputStreamFromHttp ( httpFileURL ) ; ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream ( ) ; byte [ ] buffer = new byte [ BUFFER_SIZE ] ; for ( int len = 0 ; ( len = bufferedInputStream . read ( buffer ) ) != - 1 ; ) { byteArrayOutputStream . write ( buffer , 0 , len ) ; } byte [ ] arrayOfByte1 = byteArrayOutputStream . toByteArray ( ) ; return arrayOfByte1 ; } finally { if ( bufferedInputStream != null ) bufferedInputStream . close ( ) ; } }
Get destination web file bytes .