On Mon, Aug 04, 2014 at 04:39:15PM -0400, Steve Kingsland wrote:
> I'm trying to use jclouds to write to an S3-compatible object store (Ceph),
> and I'd like to use an OutputStream to write the payload for a Blob. How do
> I do this?
> 
> I'm working on an existing system which uses a stream-based abstraction
> around all of the file I/O, that looks like this:
> 
> public interface ResourceFactory {
>     InputStream getInputStream(String resourcePath) throws IOException;
> 
>     OutputStream getOutputStream(String resourcePath) throws IOException;
> }
> 
> I was able to implement getInputStream() for *reading* a blob from jclouds,
> but I'm not sure how to return an OutputStream for *writing* a blob.
> 
> I know this question has already been asked
> <https://groups.google.com/forum/#!topic/jclouds/F2pCt9i7TSg>, but it seems
> like a common-enough use case that it shouldn't be terribly complicated to
> implement. Can anyone provide suggestions for how to accomplish this?
> 
> The best I could find is Payload#writeTo
> <http://demobox.github.io/jclouds-maven-site-1.7.2/1.7.2/jclouds/apidocs/org/jclouds/io/WriteTo.html>,
> which accepts an OutputStream but is @Deprecated. Thanks in advance!

Steve, I am not sure I understand your use case.  putBlob consumes an
input *source*, e.g., ByteSource or InputStream.  Why do you want to
provide it an output *sink*, e.g., OutputStream?  If you have a special
need, could you provide a custom implementation of ByteSource or
InputStream, or use PipedInputStream/PipedOutputStream if you really
must use an OutputStream?

-- 
Andrew Gaul
http://gaul.org/

Reply via email to