SMILA 1.0 API documentation

org.eclipse.smila.http.client.attachments
Class AttachmentWrapper

java.lang.Object
  extended by org.eclipse.smila.http.client.attachments.AttachmentWrapper
All Implemented Interfaces:
Attachments

public class AttachmentWrapper
extends java.lang.Object
implements Attachments

Use this class to wrap possible attachment values to provide them to the RestClient in a POST request.

Since:
1.1.0

Field Summary
 
Fields inherited from interface org.eclipse.smila.http.client.Attachments
MIMETYPE_ATTACHMENT
 
Constructor Summary
AttachmentWrapper()
          Create empty instance.
AttachmentWrapper(java.lang.String name, byte[] attachment)
          Create instance with one byte[] attachment.
AttachmentWrapper(java.lang.String name, java.io.File attachment)
          Create instance with one File attachment.
AttachmentWrapper(java.lang.String name, java.io.InputStream attachment)
          Create instance with one InputStream attachment.
AttachmentWrapper(java.lang.String name, java.lang.String attachment)
          Create instance with one String attachment.
 
Method Summary
 void add(java.lang.String name, byte[] attachment)
          Add one byte[] attachment.
 void add(java.lang.String name, java.io.File attachment)
          Add one File attachment.
 void add(java.lang.String name, java.io.InputStream attachment)
          Add one InputStream attachment.
 void add(java.lang.String name, java.lang.String attachment)
          Add one String attachment.
 java.util.Map<java.lang.String,ContentBody> getAttachmentParts()
          Get attachments parts to add to a multipart request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttachmentWrapper

public AttachmentWrapper()
Create empty instance.


AttachmentWrapper

public AttachmentWrapper(java.lang.String name,
                         byte[] attachment)
Create instance with one byte[] attachment. Adding more attachments is possible.

Parameters:
name - attachment name
attachment - attachment content

AttachmentWrapper

public AttachmentWrapper(java.lang.String name,
                         java.lang.String attachment)
Create instance with one String attachment. Adding more attachments is possible.

Parameters:
name - attachment name
attachment - attachment content

AttachmentWrapper

public AttachmentWrapper(java.lang.String name,
                         java.io.InputStream attachment)
Create instance with one InputStream attachment. Adding more attachments is possible.

Parameters:
name - attachment name
attachment - attachment content

AttachmentWrapper

public AttachmentWrapper(java.lang.String name,
                         java.io.File attachment)
Create instance with one File attachment. Adding more attachments is possible.

Parameters:
name - attachment name
attachment - attachment content
Method Detail

getAttachmentParts

public java.util.Map<java.lang.String,ContentBody> getAttachmentParts()
Description copied from interface: Attachments
Get attachments parts to add to a multipart request. The keys of the returned map are the attachment names. The values can wrap different kinds of attachment objects, for example simple byte{] objects or java.io.InputStreams.

Specified by:
getAttachmentParts in interface Attachments
Returns:
map of attachment names and values.

add

public void add(java.lang.String name,
                byte[] attachment)
Add one byte[] attachment.

Parameters:
name - attachment name
attachment - attachment content

add

public void add(java.lang.String name,
                java.lang.String attachment)
Add one String attachment.

Parameters:
name - attachment name
attachment - attachment content

add

public void add(java.lang.String name,
                java.io.InputStream attachment)
Add one InputStream attachment.

Parameters:
name - attachment name
attachment - attachment content

add

public void add(java.lang.String name,
                java.io.File attachment)
Add one File attachment.

Parameters:
name - attachment name
attachment - attachment content

SMILA 1.0 API documentation