/** * Indicates if transient entities should be buffered after being received * or before being sent. * * @param entityBuffering * True if transient entities should be buffered. * @see ClientResource#setRequestEntityBuffering(boolean) * @see #setResponseEntityBuffering(boolean) */ public void setEntityBuffering(boolean entityBuffering) { setRequestEntityBuffering(entityBuffering); setResponseEntityBuffering(entityBuffering); }
ClientResource cr = new ClientResource("http://10.0.2.2:8888/download/"); cr.setRequestEntityBuffering(true); DownloadResource downloadResource = cr.wrap(DownloadResourceProtocol.class); // Remote invocation - seamless: Representation representation = downloadResource.download(); // Using data: ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); IOUtils.copy(representation.getStream(), byteArrayOutputStream); byte[] byteArray = byteArrayOutputStream.toByteArray(); Log.i("Byte array: " + Arrays.toString(byteArray));