You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Francis Devereux (JIRA)" <ji...@apache.org> on 2014/01/17 11:23:21 UTC

[jira] [Comment Edited] (JCLOUDS-410) Convert InputSupplier methods to ByteSource

    [ https://issues.apache.org/jira/browse/JCLOUDS-410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13874623#comment-13874623 ] 

Francis Devereux edited comment on JCLOUDS-410 at 1/17/14 10:22 AM:
--------------------------------------------------------------------

The @deprecated tag for org.jclouds.blobstore.domain.BlobBuilder.payload(java.io.File) says to use payload(Files.asByteSource(File)) instead.

I think that the new way of doing things will not work or will perform poorly for large files but the deprecated will would work fine. This is because Files.asByteSource(File) reads the whole file into memory\(!), or fails altogether for files larger than Integer.MAX_VALUE (see com.google.common.io.Files.FileByteSource.read()) whereas as far as I can tell the deprecated way will stream the file and will thus work fine for huge files.


was (Author: frankoid):
The @deprecated tag for org.jclouds.blobstore.domain.BlobBuilder.payload(java.io.File) says to use payload(Files.asByteSource(File)) instead.

I think that the new way of doing things will not work or will perform poorly for large files but the deprecated will would work fine. This is because Files.asByteSource(File) reads the whole file into memory(!), or fails altogether for files larger than Integer.MAX_VALUE (see com.google.common.io.Files.FileByteSource.read()) whereas as far as I can tell the deprecated way will stream the file and will thus work fine for huge files.

> Convert InputSupplier<InputStream> methods to ByteSource
> --------------------------------------------------------
>
>                 Key: JCLOUDS-410
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-410
>             Project: jclouds
>          Issue Type: Improvement
>          Components: jclouds-blobstore, jclouds-core
>    Affects Versions: 1.7.0
>            Reporter: Andrew Gaul
>            Assignee: Andrew Gaul
>             Fix For: 1.8.0
>
>
> ByteSource has convenience methods and avoids generics notational overhead.  Guava is moving towards this:
>     
> https://groups.google.com/forum/#!msg/guava-discuss/bChfnnXb9QA/xlmy2UzsmpsJ
> Note that ByteSource implements InputSupplier<InputStream> so we should retain source compatibility.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)