mirror of https://github.com/apache/jclouds.git
Add PayloadEnclosing.setPayload(ByteSource)
This commit is contained in:
parent
7869d92b29
commit
a4bc36dafa
|
@ -26,6 +26,8 @@ import org.jclouds.io.Payload;
|
|||
import org.jclouds.io.PayloadEnclosing;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.io.ByteSource;
|
||||
|
||||
public class PayloadEnclosingImpl implements PayloadEnclosing {
|
||||
protected Payload payload;
|
||||
|
||||
|
@ -87,6 +89,14 @@ public class PayloadEnclosingImpl implements PayloadEnclosing {
|
|||
setPayload(newPayload(checkNotNull(data, "data")));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setPayload(ByteSource data) {
|
||||
setPayload(newPayload(checkNotNull(data, "data")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
|
|
|
@ -21,6 +21,8 @@ import java.io.InputStream;
|
|||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.io.ByteSource;
|
||||
|
||||
public interface PayloadEnclosing {
|
||||
|
||||
/**
|
||||
|
@ -28,8 +30,8 @@ public interface PayloadEnclosing {
|
|||
* attempt to discover it.
|
||||
*
|
||||
* @param data
|
||||
* typically InputStream for downloads, or File, byte [], String, or InputStream for
|
||||
* uploads.
|
||||
* typically InputStream for downloads, or File, byte[], String, InputStream,
|
||||
* of ByteSource for uploads.
|
||||
*/
|
||||
void setPayload(Payload data);
|
||||
|
||||
|
@ -41,6 +43,8 @@ public interface PayloadEnclosing {
|
|||
|
||||
void setPayload(String data);
|
||||
|
||||
void setPayload(ByteSource data);
|
||||
|
||||
@Nullable
|
||||
Payload getPayload();
|
||||
|
||||
|
|
Loading…
Reference in New Issue