mirror of https://github.com/apache/jclouds.git
Do not require Guava ByteSource in order to create a payload.
This commit is contained in:
parent
5229ec2230
commit
9105ae55fa
|
@ -77,9 +77,7 @@ public interface BlobBuilder {
|
||||||
*
|
*
|
||||||
* @param payload
|
* @param payload
|
||||||
* payload you wish to construct the {@link Blob} with.
|
* payload you wish to construct the {@link Blob} with.
|
||||||
* @deprecated see payload(ByteSource.wrap(byte[])
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
PayloadBlobBuilder payload(byte[] payload);
|
PayloadBlobBuilder payload(byte[] payload);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,18 +89,14 @@ public interface BlobBuilder {
|
||||||
*
|
*
|
||||||
* @param payload
|
* @param payload
|
||||||
* payload you wish to construct the {@link Blob} with.
|
* payload you wish to construct the {@link Blob} with.
|
||||||
* @deprecated see payload(ByteSource.wrap(String.getBytes()))
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
PayloadBlobBuilder payload(String payload);
|
PayloadBlobBuilder payload(String payload);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param payload
|
* @param payload
|
||||||
* payload you wish to construct the {@link Blob} with.
|
* payload you wish to construct the {@link Blob} with.
|
||||||
* @deprecated see payload(Files.asByteSource(File))
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
PayloadBlobBuilder payload(File payload);
|
PayloadBlobBuilder payload(File payload);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -64,9 +64,7 @@ public class HttpMessage extends PayloadEnclosingImpl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HttpMessage#getPayload()
|
* @see HttpMessage#getPayload()
|
||||||
* @deprecated see payload(ByteSource.wrap(byte[]))
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public T payload(byte [] payload) {
|
public T payload(byte [] payload) {
|
||||||
this.payload = Payloads.newByteArrayPayload(checkNotNull(payload, "payload"));
|
this.payload = Payloads.newByteArrayPayload(checkNotNull(payload, "payload"));
|
||||||
return self();
|
return self();
|
||||||
|
@ -82,9 +80,7 @@ public class HttpMessage extends PayloadEnclosingImpl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HttpMessage#getPayload()
|
* @see HttpMessage#getPayload()
|
||||||
* @deprecated see payload(Files.asByteSource(File))
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public T payload(File payload) {
|
public T payload(File payload) {
|
||||||
this.payload = Payloads.newFilePayload(checkNotNull(payload, "payload"));
|
this.payload = Payloads.newFilePayload(checkNotNull(payload, "payload"));
|
||||||
return self();
|
return self();
|
||||||
|
@ -100,9 +96,7 @@ public class HttpMessage extends PayloadEnclosingImpl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HttpMessage#getPayload()
|
* @see HttpMessage#getPayload()
|
||||||
* @deprecated see payload(ByteSource.wrap(String.getBytes()))
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public T payload(String payload) {
|
public T payload(String payload) {
|
||||||
this.payload = Payloads.newStringPayload(checkNotNull(payload, "payload"));
|
this.payload = Payloads.newStringPayload(checkNotNull(payload, "payload"));
|
||||||
return self();
|
return self();
|
||||||
|
|
|
@ -64,7 +64,6 @@ import com.google.common.collect.ImmutableMultimap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.collect.ImmutableSet.Builder;
|
import com.google.common.collect.ImmutableSet.Builder;
|
||||||
import com.google.common.io.ByteSource;
|
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
|
@ -159,7 +158,7 @@ public class HttpUtils {
|
||||||
public static byte[] closeClientButKeepContentStream(PayloadEnclosing response) {
|
public static byte[] closeClientButKeepContentStream(PayloadEnclosing response) {
|
||||||
byte[] returnVal = toByteArrayOrNull(response);
|
byte[] returnVal = toByteArrayOrNull(response);
|
||||||
if (returnVal != null && !response.getPayload().isRepeatable()) {
|
if (returnVal != null && !response.getPayload().isRepeatable()) {
|
||||||
Payload newPayload = Payloads.newByteSourcePayload(ByteSource.wrap(returnVal));
|
Payload newPayload = Payloads.newByteArrayPayload(returnVal);
|
||||||
MutableContentMetadata fromMd = response.getPayload().getContentMetadata();
|
MutableContentMetadata fromMd = response.getPayload().getContentMetadata();
|
||||||
MutableContentMetadata toMd = newPayload.getContentMetadata();
|
MutableContentMetadata toMd = newPayload.getContentMetadata();
|
||||||
copy(fromMd, toMd);
|
copy(fromMd, toMd);
|
||||||
|
|
|
@ -35,10 +35,6 @@ public class Payloads {
|
||||||
private Payloads() {
|
private Payloads() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated see newPayload(ByteSource) or newPayload(InputStream)
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static Payload newPayload(Object data) {
|
public static Payload newPayload(Object data) {
|
||||||
checkNotNull(data, "data");
|
checkNotNull(data, "data");
|
||||||
if (data instanceof Payload) {
|
if (data instanceof Payload) {
|
||||||
|
@ -62,10 +58,6 @@ public class Payloads {
|
||||||
return new InputStreamPayload(checkNotNull(data, "data"));
|
return new InputStreamPayload(checkNotNull(data, "data"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated see newPayload(ByteSource)
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static ByteArrayPayload newByteArrayPayload(byte[] data) {
|
public static ByteArrayPayload newByteArrayPayload(byte[] data) {
|
||||||
return new ByteArrayPayload(checkNotNull(data, "data"));
|
return new ByteArrayPayload(checkNotNull(data, "data"));
|
||||||
}
|
}
|
||||||
|
@ -74,18 +66,10 @@ public class Payloads {
|
||||||
return new ByteSourcePayload(checkNotNull(data, "data"));
|
return new ByteSourcePayload(checkNotNull(data, "data"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated see newPayload(ByteSource)
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static StringPayload newStringPayload(String data) {
|
public static StringPayload newStringPayload(String data) {
|
||||||
return new StringPayload(checkNotNull(data, "data"));
|
return new StringPayload(checkNotNull(data, "data"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated see newPayload(ByteSource)
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static FilePayload newFilePayload(File data) {
|
public static FilePayload newFilePayload(File data) {
|
||||||
return new FilePayload(checkNotNull(data, "data"));
|
return new FilePayload(checkNotNull(data, "data"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated see ByteSourcePayload
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class ByteArrayPayload extends BasePayload<byte[]> {
|
public class ByteArrayPayload extends BasePayload<byte[]> {
|
||||||
public ByteArrayPayload(byte[] content) {
|
public ByteArrayPayload(byte[] content) {
|
||||||
this(content, null);
|
this(content, null);
|
||||||
|
|
|
@ -24,10 +24,6 @@ import java.io.InputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated see ByteSourcePayload
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class FilePayload extends BasePayload<File> {
|
public class FilePayload extends BasePayload<File> {
|
||||||
|
|
||||||
public FilePayload(File content) {
|
public FilePayload(File content) {
|
||||||
|
|
|
@ -25,9 +25,7 @@ import com.google.common.base.Charsets;
|
||||||
* This implementation converts the String to a byte array using UTF-8 encoding. If you wish to use
|
* This implementation converts the String to a byte array using UTF-8 encoding. If you wish to use
|
||||||
* a different encoding, please use {@link ByteArrayPayload}.
|
* a different encoding, please use {@link ByteArrayPayload}.
|
||||||
*
|
*
|
||||||
* @deprecated see ByteSourcePayload
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public class StringPayload extends BasePayload<String> {
|
public class StringPayload extends BasePayload<String> {
|
||||||
|
|
||||||
private final byte[] bytes;
|
private final byte[] bytes;
|
||||||
|
|
Loading…
Reference in New Issue