org.jclouds.io
Class Payloads

java.lang.Object
  extended by org.jclouds.io.Payloads

public class Payloads
extends Object

Author:
Adrian Cole

Method Summary
static Payload calculateMD5(Payload payload)
          Uses default md5 generator.
static Payload calculateMD5(Payload payload, MessageDigest md5)
          Calculates and sets Payload#setContentMD5 on the payload.
static
<T extends PayloadEnclosing>
T
calculateMD5(T payloadEnclosing)
          Calculates the md5 on a payload, replacing as necessary.
static
<T extends PayloadEnclosing>
T
calculateMD5(T payloadEnclosing, MessageDigest md5)
          Calculates the md5 on a payload, replacing as necessary.
static ByteArrayPayload newByteArrayPayload(byte[] data)
           
static FilePayload newFilePayload(File data)
           
static InputStreamPayload newInputStreamPayload(InputStream data)
           
static Payload newPayload(Object data)
           
static StringPayload newStringPayload(String data)
           
static UrlEncodedFormPayload newUrlEncodedFormPayload(com.google.common.collect.Multimap<String,String> formParams, char... skips)
           
static UrlEncodedFormPayload newUrlEncodedFormPayload(com.google.common.collect.Multimap<String,String> formParams, Comparator<Map.Entry<String,String>> sorter, char... skips)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newPayload

public static Payload newPayload(Object data)

newInputStreamPayload

public static InputStreamPayload newInputStreamPayload(InputStream data)

newByteArrayPayload

public static ByteArrayPayload newByteArrayPayload(byte[] data)

newStringPayload

public static StringPayload newStringPayload(String data)

newFilePayload

public static FilePayload newFilePayload(File data)

newUrlEncodedFormPayload

public static UrlEncodedFormPayload newUrlEncodedFormPayload(com.google.common.collect.Multimap<String,String> formParams,
                                                             char... skips)

newUrlEncodedFormPayload

public static UrlEncodedFormPayload newUrlEncodedFormPayload(com.google.common.collect.Multimap<String,String> formParams,
                                                             @Nullable
                                                             Comparator<Map.Entry<String,String>> sorter,
                                                             char... skips)

calculateMD5

public static Payload calculateMD5(Payload payload,
                                   MessageDigest md5)
                            throws IOException
Calculates and sets Payload#setContentMD5 on the payload.

note that this will rebuffer in memory if the payload is not repeatable.

Parameters:
payload - payload to calculate
md5 - digester to calculate payloads with.
Returns:
new Payload with md5 set.
Throws:
IOException

calculateMD5

public static Payload calculateMD5(Payload payload)
                            throws IOException
Uses default md5 generator.

Throws:
IOException
See Also:
calculateMD5(Payload, MessageDigest)

calculateMD5

public static <T extends PayloadEnclosing> T calculateMD5(T payloadEnclosing,
                                                          MessageDigest md5)
                                               throws IOException
Calculates the md5 on a payload, replacing as necessary.

Throws:
IOException
See Also:
calculateMD5(Payload, MessageDigest)

calculateMD5

public static <T extends PayloadEnclosing> T calculateMD5(T payloadEnclosing)
                                               throws IOException
Calculates the md5 on a payload, replacing as necessary.

uses default md5 generator.

Throws:
IOException
See Also:
calculateMD5(Payload, MessageDigest)


Copyright © 2009-2011 jclouds. All Rights Reserved.