> -      blobStore.createContainerInLocation(null, containerName);
> -      Blob blob = blobStore.blobBuilder(key)
> -         .payload(fileToUpload)
> -         .build();
> -      blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart());
> +   private File createFileExactly(long fileSize, String filename) throws 
> IOException {
> +       File fileToUpload = new File("target", filename);
> +       fileToUpload.delete();
> +       final String content = 
> "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
> +       final byte[] contentBytes = content.getBytes("UTF-8");
> +       Random random = new Random();
> +       ByteSink byteSink = Files.asByteSink(fileToUpload, 
> FileWriteMode.APPEND);
> +       for (int i = 0; i < fileSize; i++) {
> +           int position = random.nextInt(content.length());
> +           byte contentByte = contentBytes[position];
> +           byteSink.write(new byte[]{contentByte});

All of this code will go away with the suggested `ByteSource` changes, but note 
that this code is wildly inefficient, requiring one system call per byte.

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

Reply via email to