> +   private List<Long> storeData(InputStream data) throws IOException {
> +      ImmutableList.Builder<Long> chunks = ImmutableList.builder();
> +      int bytes;
> +      byte[] buffer = new byte[JdbcConstants.DEFAULT_CHUNK_SIZE];
> +      while ((bytes = data.read(buffer, 0, 
> JdbcConstants.DEFAULT_CHUNK_SIZE)) != -1) {
> +         chunks.add(chunkRepository.create(new ChunkEntity(buffer, 
> bytes)).getId());
> +         buffer = new byte[JdbcConstants.DEFAULT_CHUNK_SIZE];
> +      }
> +      data.close();
> +      return chunks.build();
> +   }
> +
> +   private void checkIntegrity(Blob blob, BlobEntity entity) throws 
> IOException {
> +      HashCode hash = 
> blob.getMetadata().getContentMetadata().getContentMD5AsHashCode();
> +      if (hash != null) {
> +         HashingInputStream his = new HashingInputStream(Hashing.md5(), new 
> JdbcInputStream(this, entity.getPayload().getChunks()));

Do you need to close the input stream?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/176/files#r32473762

Reply via email to