PayloadBlobBuilder blobBuilder = view.getBlobStore().blobBuilder("streaming").payload(
new StreamingPayload(new WriteTo() {
@Override
public void writeTo(OutputStream outstream) throws IOException {
outstream.write("foo".getBytes());
}
}));
I am trying to use jcloud to write files from my system into a cloud file storage. In this case I am sending the file through a templating engine and then the result gets sent out to the blob. I would prefer to get an output stream from the blob and just send my file and the output stream into the template engine and let it do the processing. So far I have not seen a way to grab an output stream for the blob, it only allows for passing an input stream for the copy. Any ideas on this?There is another way to do it and that would be to write the results to a temporary file and then out, but I was trying to avoid this.
--
You received this message because you are subscribed to the Google Groups "jclouds" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jclouds+u...@googlegroups.com.
To post to this group, send email to jcl...@googlegroups.com.
Visit this group at http://groups.google.com/group/jclouds?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
final BlobStoreContext context = ContextBuilder.newBuilder("cloudfiles-us")
.credentials(args[0], args[1])
.buildView(BlobStoreContext.class);
java.io.PipedInputStream in = new java.io.PipedInputStream();
java.io.PipedOutputStream out = new java.io.PipedOutputStream( in );
object.getInfo().setName("testasyc.java");
object.setPayload(in);
final ListenableFuture<String> futureETag = swift.getAsyncApi().putObject( CONTAINER_NAME, object );Thread thread = new Thread( new Runnable() {public void run(){try {
futureETag.get();context.close();}catch ( Exception e ) {throw new RuntimeException();}}});thread.start();
for ( int i = 0; i < 100; i++ ) {out.write( ("Test " + i).getBytes() );}out.flush();out.close();
futureETag.get();
--
You received this message because you are subscribed to the Google Groups "jclouds" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jclouds+unsubscribe@googlegroups.com.