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
Direct Known Subclasses:
ByteArrayPayload, ByteSourcePayload, FilePayload, InputStreamPayload, MultipartForm, PhantomPayload, StringPayload, UrlEncodedFormPayload

public abstract class BasePayload<V>
extends Object
implements Payload


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()
          
 InputStream getInput()
          Creates a new InputStream object of the payload.
 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()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jclouds.io.Payload
openStream
 

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

getInput

public InputStream getInput()
Description copied from interface: Payload
Creates a new InputStream object of the payload.

Specified by:
getInput in interface com.google.common.io.InputSupplier<InputStream>
Specified by:
getInput in interface Payload

getRawContent

public V getRawContent()
Payload in its original form.

Specified by:
getRawContent in interface Payload

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-2014 The Apache Software Foundation. All Rights Reserved.