org.jclouds.io.payloads
Class BasePayload<V>

java.lang.Object
  extended by org.jclouds.io.payloads.BasePayload<V>
All Implemented Interfaces:
com.google.common.io.InputSupplier<InputStream>, Closeable, Payload, WriteTo
Direct Known Subclasses:
ApacheHCUtils.HttpEntityPayload, ByteArrayPayload, FilePayload, InputStreamPayload, InputStreamSupplierPayload, MultipartForm, PhantomPayload, StringPayload, UrlEncodedFormPayload

public abstract class BasePayload<V>
extends Object
implements Payload

Author:
Adrian Cole

Field Summary
protected  V content
           
protected  MutableContentMetadata contentMetadata
           
protected  boolean written
           
 
Constructor Summary
protected BasePayload(V content)
           
protected BasePayload(V content, MutableContentMetadata contentMetadata)
           
 
Method Summary
 void close()
          Delegates to release()
 boolean equals(Object obj)
           
 MutableContentMetadata getContentMetadata()
          
 V getRawContent()
          Payload in its original form.
 int hashCode()
           
 boolean isRepeatable()
          By default we are repeatable.
 void release()
          By default there are no resources to release.
 void setContentMetadata(MutableContentMetadata in)
          
 String toString()
           
 void writeTo(OutputStream outstream)
          Writes the payload content to the output stream.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jclouds.io.Payload
getInput
 

Field Detail

content

protected final V content

written

protected transient volatile boolean written

contentMetadata

protected MutableContentMetadata contentMetadata
Constructor Detail

BasePayload

protected BasePayload(V content)

BasePayload

protected BasePayload(V content,
                      MutableContentMetadata contentMetadata)
Method Detail

getRawContent

public V getRawContent()
Payload in its original form.

Specified by:
getRawContent in interface Payload

writeTo

public void writeTo(OutputStream outstream)
             throws IOException
Writes the payload content to the output stream.

Specified by:
writeTo in interface WriteTo
Throws:
IOException

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

isRepeatable

public boolean isRepeatable()
By default we are repeatable.

Specified by:
isRepeatable in interface Payload

release

public void release()
By default there are no resources to release.

Specified by:
release in interface Payload

close

public void close()
Delegates to release()

Specified by:
close in interface Closeable

getContentMetadata

public MutableContentMetadata getContentMetadata()

Specified by:
getContentMetadata in interface Payload

setContentMetadata

public void setContentMetadata(MutableContentMetadata in)

Specified by:
setContentMetadata in interface Payload


Copyright © 2009-2011 jclouds. All Rights Reserved.