You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2014/07/03 00:32:05 UTC

[2/2] git commit: Backport ByteSources.repeatingArrayByteSource

Backport ByteSources.repeatingArrayByteSource


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/b41c4c2a
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/b41c4c2a
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/b41c4c2a

Branch: refs/heads/1.7.x
Commit: b41c4c2ab005687e252661ee7e8d508c9c0369a6
Parents: 10a1b23
Author: Andrew Gaul <ga...@apache.org>
Authored: Thu May 22 10:43:57 2014 -0700
Committer: Andrew Gaul <ga...@apache.org>
Committed: Wed Jul 2 15:30:15 2014 -0700

----------------------------------------------------------------------
 core/src/main/java/org/jclouds/io/ByteSources.java | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/b41c4c2a/core/src/main/java/org/jclouds/io/ByteSources.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/io/ByteSources.java b/core/src/main/java/org/jclouds/io/ByteSources.java
index 06fe135..7055664 100644
--- a/core/src/main/java/org/jclouds/io/ByteSources.java
+++ b/core/src/main/java/org/jclouds/io/ByteSources.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import com.google.common.annotations.Beta;
+import com.google.common.collect.Iterables;
 import com.google.common.io.ByteSource;
 
 /**
@@ -48,4 +49,8 @@ public class ByteSources {
       };
    }
 
+   /** Create an infinite-length ByteSource which repeats its input. */
+   public static ByteSource repeatingArrayByteSource(final byte[] input) {
+      return ByteSource.concat(Iterables.cycle(ByteSource.wrap(input)));
+   }
 }