public class AttachmentPartImpl extends AttachmentPart
AttachmentPart
interface.AttachmentPart
Constructor and Description |
---|
AttachmentPartImpl() |
AttachmentPartImpl(DataHandler handler) |
Modifier and Type | Method and Description |
---|---|
void |
addMimeHeader(String name,
String value) |
void |
clearContent() |
Iterator |
getAllMimeHeaders() |
InputStream |
getBase64Content()
Returns an InputStream which can be used to obtain the content of AttachmentPart as Base64 encoded character data,
this method would base64 encode the raw bytes of the attachment and return.
|
Object |
getContent() |
String |
getContentId() |
String |
getContentLocation() |
String |
getContentType() |
DataHandler |
getDataHandler() |
String |
getFirstMimeHeader(String header)
Returns the first occurence of a MIME header.
|
Iterator |
getMatchingMimeHeaders(String[] names) |
String[] |
getMimeHeader(String name) |
Iterator |
getNonMatchingMimeHeaders(String[] names) |
InputStream |
getRawContent()
Gets the content of this AttachmentPart object as an InputStream
as if a call had been made to getContent and no DataContentHandler
had been registered for the content-type of this AttachmentPart.
|
byte[] |
getRawContentBytes()
Gets the content of this AttachmentPart object as a byte[] array as if a call had been
made to getContent and no DataContentHandler had been registered for the content-type of this AttachmentPart.
|
int |
getSize() |
void |
removeAllMimeHeaders() |
void |
removeMimeHeader(String name) |
void |
setBase64Content(InputStream content,
String contentType)
Sets the content of this attachment part from the Base64 source InputStream
and sets the value of the Content-Type header to the value contained in contentType,
This method would first decode the base64 input and write the resulting raw bytes to the attachment.
|
void |
setContent(Object object,
String contentType)
Sets the content of this attachment part to that of the given Object and sets the value of the Content-Type header
to the given type.
|
void |
setContentId(String contentId) |
void |
setContentLocation(String contentLocation) |
void |
setContentType(String contentType) |
void |
setDataHandler(DataHandler dataHandler) |
void |
setMimeHeader(String name,
String value) |
void |
setRawContent(InputStream content,
String contentType)
Sets the content of this attachment part to that contained by the InputStream content and sets the value of the Content-Type header to the value contained in contentType.
|
void |
setRawContentBytes(byte[] content,
int offset,
int len,
String contentType)
Sets the content of this attachment part to that contained
by the byte[] array content and sets the value of the Content-Type
header to the value contained in contentType.
|
public AttachmentPartImpl()
public AttachmentPartImpl(DataHandler handler)
public void addMimeHeader(String name, String value)
addMimeHeader
in class AttachmentPart
public void clearContent()
clearContent
in class AttachmentPart
public Iterator getAllMimeHeaders()
getAllMimeHeaders
in class AttachmentPart
public Object getContent() throws SOAPException
getContent
in class AttachmentPart
SOAPException
public DataHandler getDataHandler() throws SOAPException
getDataHandler
in class AttachmentPart
SOAPException
public Iterator getMatchingMimeHeaders(String[] names)
getMatchingMimeHeaders
in class AttachmentPart
public String[] getMimeHeader(String name)
getMimeHeader
in class AttachmentPart
public String getFirstMimeHeader(String header)
header
- the mime headerpublic Iterator getNonMatchingMimeHeaders(String[] names)
getNonMatchingMimeHeaders
in class AttachmentPart
public int getSize() throws SOAPException
getSize
in class AttachmentPart
SOAPException
public void removeAllMimeHeaders()
removeAllMimeHeaders
in class AttachmentPart
public void removeMimeHeader(String name)
removeMimeHeader
in class AttachmentPart
public void setContent(Object object, String contentType)
setContent
in class AttachmentPart
object
- the Java object that makes up the content for this attachment partcontentType
- the MIME string that specifies the type of the contentIllegalArgumentException
- if the contentType does not match the type of the content object,
or if there was no DataContentHandler object for this content objectpublic void setDataHandler(DataHandler dataHandler)
setDataHandler
in class AttachmentPart
public void setMimeHeader(String name, String value)
setMimeHeader
in class AttachmentPart
public String getContentId()
getContentId
in class AttachmentPart
public String getContentLocation()
getContentLocation
in class AttachmentPart
public String getContentType()
getContentType
in class AttachmentPart
public void setContentId(String contentId)
setContentId
in class AttachmentPart
public void setContentLocation(String contentLocation)
setContentLocation
in class AttachmentPart
public void setContentType(String contentType)
setContentType
in class AttachmentPart
public InputStream getBase64Content() throws SOAPException
getBase64Content
in class AttachmentPart
SOAPException
- if there is no content set into this AttachmentPart object or if there was a data transformation error.public InputStream getRawContent() throws SOAPException
getRawContent
in class AttachmentPart
SOAPException
- if there is no content set into this AttachmentPart object or if there was a data transformation error.public byte[] getRawContentBytes() throws SOAPException
getRawContentBytes
in class AttachmentPart
SOAPException
- if there is no content set into this AttachmentPart object or if there was a data transformation error.public void setBase64Content(InputStream content, String contentType) throws SOAPException
setBase64Content
in class AttachmentPart
content
- the base64 encoded data to add to the attachment partcontentType
- the value to set into the Content-Type headerSOAPException
- if an there is an error in setting the contentNullPointerException
- if content is nullpublic void setRawContent(InputStream content, String contentType) throws SOAPException
setRawContent
in class AttachmentPart
content
- the raw data to add to the attachment partcontentType
- the value to set into the Content-Type headerSOAPException
- if an there is an error in setting the contentNullPointerException
- if content is nullpublic void setRawContentBytes(byte[] content, int offset, int len, String contentType) throws SOAPException
setRawContentBytes
in class AttachmentPart
content
- the raw data to add to the attachment partcontentType
- the value to set into the Content-Type headeroffset
- the offset in the byte array of the contentlen
- the number of bytes that form the contentSOAPException
- if an there is an error in setting the content or content is nullCopyright © 2013 JBoss, by Red Hat. All Rights Reserved.