public byte [ ] bytes ( ) { connect ( ) ; ByteArrayOutputStream bout = new ByteArrayOutputStream ( ) ; byte [ ] bytes = new byte [ 1024 ] ; int count ; try { InputStream in = connection . getInputStream ( ) ; while ( ( count = in . read ( bytes ) ) != - 1 ) { bout . write ( bytes , 0 , count ) ; } } catch ( Exception e ) { throw new HttpException ( "Failed URL: " + url , e ) ; } finally { dispose ( ) ; } return bout . toByteArray ( ) ; }
Fetches response content from server as bytes .