Do not require Guava ByteSource in order to create a payload.

This commit is contained in:
Adrian Cole 2014-10-28 16:02:12 -07:00 committed by Adrian Cole
parent 5229ec2230
commit 9105ae55fa
7 changed files with 1 additions and 40 deletions

View File

@ -77,9 +77,7 @@ public interface BlobBuilder {
*
* @param payload
* payload you wish to construct the {@link Blob} with.
* @deprecated see payload(ByteSource.wrap(byte[])
*/
@Deprecated
PayloadBlobBuilder payload(byte[] payload);
/**
@ -91,18 +89,14 @@ public interface BlobBuilder {
*
* @param payload
* payload you wish to construct the {@link Blob} with.
* @deprecated see payload(ByteSource.wrap(String.getBytes()))
*/
@Deprecated
PayloadBlobBuilder payload(String payload);
/**
*
* @param payload
* payload you wish to construct the {@link Blob} with.
* @deprecated see payload(Files.asByteSource(File))
*/
@Deprecated
PayloadBlobBuilder payload(File payload);
/**

View File

@ -64,9 +64,7 @@ public class HttpMessage extends PayloadEnclosingImpl {
/**
* @see HttpMessage#getPayload()
* @deprecated see payload(ByteSource.wrap(byte[]))
*/
@Deprecated
public T payload(byte [] payload) {
this.payload = Payloads.newByteArrayPayload(checkNotNull(payload, "payload"));
return self();
@ -82,9 +80,7 @@ public class HttpMessage extends PayloadEnclosingImpl {
/**
* @see HttpMessage#getPayload()
* @deprecated see payload(Files.asByteSource(File))
*/
@Deprecated
public T payload(File payload) {
this.payload = Payloads.newFilePayload(checkNotNull(payload, "payload"));
return self();
@ -100,9 +96,7 @@ public class HttpMessage extends PayloadEnclosingImpl {
/**
* @see HttpMessage#getPayload()
* @deprecated see payload(ByteSource.wrap(String.getBytes()))
*/
@Deprecated
public T payload(String payload) {
this.payload = Payloads.newStringPayload(checkNotNull(payload, "payload"));
return self();

View File

@ -64,7 +64,6 @@ import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.common.collect.ImmutableSet.Builder;
import com.google.common.io.ByteSource;
import com.google.common.reflect.Invokable;
import com.google.inject.Inject;
@ -159,7 +158,7 @@ public class HttpUtils {
public static byte[] closeClientButKeepContentStream(PayloadEnclosing response) {
byte[] returnVal = toByteArrayOrNull(response);
if (returnVal != null && !response.getPayload().isRepeatable()) {
Payload newPayload = Payloads.newByteSourcePayload(ByteSource.wrap(returnVal));
Payload newPayload = Payloads.newByteArrayPayload(returnVal);
MutableContentMetadata fromMd = response.getPayload().getContentMetadata();
MutableContentMetadata toMd = newPayload.getContentMetadata();
copy(fromMd, toMd);

View File

@ -35,10 +35,6 @@ public class Payloads {
private Payloads() {
}
/**
* @deprecated see newPayload(ByteSource) or newPayload(InputStream)
*/
@Deprecated
public static Payload newPayload(Object data) {
checkNotNull(data, "data");
if (data instanceof Payload) {
@ -62,10 +58,6 @@ public class Payloads {
return new InputStreamPayload(checkNotNull(data, "data"));
}
/**
* @deprecated see newPayload(ByteSource)
*/
@Deprecated
public static ByteArrayPayload newByteArrayPayload(byte[] data) {
return new ByteArrayPayload(checkNotNull(data, "data"));
}
@ -74,18 +66,10 @@ public class Payloads {
return new ByteSourcePayload(checkNotNull(data, "data"));
}
/**
* @deprecated see newPayload(ByteSource)
*/
@Deprecated
public static StringPayload newStringPayload(String data) {
return new StringPayload(checkNotNull(data, "data"));
}
/**
* @deprecated see newPayload(ByteSource)
*/
@Deprecated
public static FilePayload newFilePayload(File data) {
return new FilePayload(checkNotNull(data, "data"));
}

View File

@ -22,10 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
/**
* @deprecated see ByteSourcePayload
*/
@Deprecated
public class ByteArrayPayload extends BasePayload<byte[]> {
public ByteArrayPayload(byte[] content) {
this(content, null);

View File

@ -24,10 +24,6 @@ import java.io.InputStream;
import java.io.IOException;
/**
* @deprecated see ByteSourcePayload
*/
@Deprecated
public class FilePayload extends BasePayload<File> {
public FilePayload(File content) {

View File

@ -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
* a different encoding, please use {@link ByteArrayPayload}.
*
* @deprecated see ByteSourcePayload
*/
@Deprecated
public class StringPayload extends BasePayload<String> {
private final byte[] bytes;