List of usage examples for org.apache.http.client.cache Resource getInputStream
InputStream getInputStream() throws IOException;
From source file:org.apache.http.impl.client.cache.TestHttpCacheEntrySerializers.java
private byte[] resourceToBytes(Resource res) throws IOException { InputStream inputStream = res.getInputStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); int readBytes; byte[] bytes = new byte[8096]; while ((readBytes = inputStream.read(bytes)) > 0) { outputStream.write(bytes, 0, readBytes); }//from w ww. j ava 2 s . c o m byte[] byteData = outputStream.toByteArray(); inputStream.close(); outputStream.close(); return byteData; }