@Override public byte[] call() throws Exception { boolean threw = true; InputStream stream = getStream(blobId.blobId); try { byte[] result = IOUtils.toByteArray(stream); threw = false; return result; } finally { Closeables.close(stream, threw); } } });
@Override public byte[] call() throws Exception { boolean threw = true; InputStream stream = getStream(blobId.blobId); try { byte[] result = IOUtils.toByteArray(stream); threw = false; return result; } finally { Closeables.close(stream, threw); } } });
@Override public byte[] call() throws Exception { boolean threw = true; InputStream stream = getStream(blobId.blobId); try { byte[] result = IOUtils.toByteArray(stream); threw = false; return result; } finally { Closeables.close(stream, threw); } } });
@Override public InputStream getInputStream(final String encodedBlobId) throws IOException { final BlobId blobId = BlobId.of(encodedBlobId); if (encodeLengthInId && blobId.hasLengthInfo() && blobId.length <= maxCachedBinarySize) { try { byte[] content = cache.get(blobId.blobId, new Callable<byte[]>() { @Override public byte[] call() throws Exception { boolean threw = true; InputStream stream = getStream(blobId.blobId); try { byte[] result = IOUtils.toByteArray(stream); threw = false; return result; } finally { Closeables.close(stream, threw); } } }); return new ByteArrayInputStream(content); } catch (ExecutionException e) { log.warn("Error occurred while loading bytes from steam while fetching for id {}", encodedBlobId, e); } } return getStream(blobId.blobId); }
@Override public InputStream getInputStream(final String encodedBlobId) throws IOException { final BlobId blobId = BlobId.of(encodedBlobId); if (encodeLengthInId && blobId.hasLengthInfo() && blobId.length <= maxCachedBinarySize) { try { byte[] content = cache.get(blobId.blobId, new Callable<byte[]>() { @Override public byte[] call() throws Exception { boolean threw = true; InputStream stream = getStream(blobId.blobId); try { byte[] result = IOUtils.toByteArray(stream); threw = false; return result; } finally { Closeables.close(stream, threw); } } }); return new ByteArrayInputStream(content); } catch (ExecutionException e) { log.warn("Error occurred while loading bytes from steam while fetching for id {}", encodedBlobId, e); } } return getStream(blobId.blobId); }
@Override public InputStream getInputStream(final String encodedBlobId) throws IOException { final BlobId blobId = BlobId.of(encodedBlobId); if (encodeLengthInId && blobId.hasLengthInfo() && blobId.length <= maxCachedBinarySize) { try { byte[] content = cache.get(blobId.blobId, new Callable<byte[]>() { @Override public byte[] call() throws Exception { boolean threw = true; InputStream stream = getStream(blobId.blobId); try { byte[] result = IOUtils.toByteArray(stream); threw = false; return result; } finally { Closeables.close(stream, threw); } } }); return new ByteArrayInputStream(content); } catch (ExecutionException e) { log.warn("Error occurred while loading bytes from steam while fetching for id {}", encodedBlobId, e); } } return getStream(blobId.blobId); }