/** * Retrieve the bytes at the specified path. * * @param path - encoded but not fully qualified. Must NOT be slash prefixed as it will be * appended to the host's url * @return * @throws com.ettrema.httpclient.HttpException */ public synchronized byte[] get(String path) throws com.ettrema.httpclient.HttpException, NotAuthorizedException, BadRequestException, ConflictException, NotFoundException { String url = this.encodedUrl() + path; final ByteArrayOutputStream out = new ByteArrayOutputStream(); try { transferService.get( url, new StreamReceiver() { @Override public void receive(InputStream in) { try { IOUtils.copy(in, out); } catch (IOException ex) { throw new RuntimeException(ex); } } }, null, null); } catch (CancelledException ex) { throw new RuntimeException("Should never happen because no progress listener is set", ex); } return out.toByteArray(); }