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.io.PayloadEnclosing;
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteSource;
|
||||||
|
|
||||||
public class PayloadEnclosingImpl implements PayloadEnclosing {
|
public class PayloadEnclosingImpl implements PayloadEnclosing {
|
||||||
protected Payload payload;
|
protected Payload payload;
|
||||||
|
|
||||||
|
@ -87,6 +89,14 @@ public class PayloadEnclosingImpl implements PayloadEnclosing {
|
||||||
setPayload(newPayload(checkNotNull(data, "data")));
|
setPayload(newPayload(checkNotNull(data, "data")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setPayload(ByteSource data) {
|
||||||
|
setPayload(newPayload(checkNotNull(data, "data")));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
|
|
|
@ -21,6 +21,8 @@ import java.io.InputStream;
|
||||||
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteSource;
|
||||||
|
|
||||||
public interface PayloadEnclosing {
|
public interface PayloadEnclosing {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,8 +30,8 @@ public interface PayloadEnclosing {
|
||||||
* attempt to discover it.
|
* attempt to discover it.
|
||||||
*
|
*
|
||||||
* @param data
|
* @param data
|
||||||
* typically InputStream for downloads, or File, byte [], String, or InputStream for
|
* typically InputStream for downloads, or File, byte[], String, InputStream,
|
||||||
* uploads.
|
* of ByteSource for uploads.
|
||||||
*/
|
*/
|
||||||
void setPayload(Payload data);
|
void setPayload(Payload data);
|
||||||
|
|
||||||
|
@ -41,6 +43,8 @@ public interface PayloadEnclosing {
|
||||||
|
|
||||||
void setPayload(String data);
|
void setPayload(String data);
|
||||||
|
|
||||||
|
void setPayload(ByteSource data);
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
Payload getPayload();
|
Payload getPayload();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue