attachmentpart.html

来自「j2ee帮助文档软件设计/软件工程 文件格式」· HTML 代码 · 共 1,109 行 · 第 1/4 页

HTML
1,109
字号
 <code>text/plain</code>, a <code>javax.xml.transform.stream.StreamSource</code> object corresponding to a content stream with a <code>Content-Type</code> value of <code>text/xml</code>, a <code>java.awt.Image</code> object corresponding to a content stream with a <code>Content-Type</code> value of <code>image/gif</code> or <code>image/jpeg</code>.  For those content types that an  installed <code>DataContentHandler</code> object does not understand, the <code>DataContentHandler</code> object is required to return a <code>java.io.InputStream</code> object with the raw bytes.<P><DD><DL><DT><B>Returns:</B><DD>a Java object with the content of this <code>AttachmentPart</code>         object<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/xml/soap/SOAPException.html" title="class in javax.xml.soap">SOAPException</A></CODE> - if there is no content set into this            <code>AttachmentPart</code> object or if there was a data            transformation error</DL></DD></DL><HR><A NAME="getRawContent()"><!-- --></A><H3>getRawContent</H3><PRE>public abstract <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/io/InputStream.html" title="class or interface in java.io">InputStream</A> <B>getRawContent</B>()                                   throws <A HREF="../../../javax/xml/soap/SOAPException.html" title="class in javax.xml.soap">SOAPException</A></PRE><DL><DD>Gets the content of this <code>AttachmentPart</code> object as an  InputStream as if a call had been made to <code>getContent</code> and no <code>DataContentHandler</code> had been registered for the  <code>content-type</code> of this <code>AttachmentPart</code>.<p> Note that reading from the returned InputStream would result in consuming  the data in the stream. It is the responsibility of the caller to reset the InputStream appropriately before calling a Subsequent API. If a copy of the raw attachment content is required then the <A HREF="../../../javax/xml/soap/AttachmentPart.html#getRawContentBytes()"><CODE>getRawContentBytes()</CODE></A> API  should be used instead.<P><DD><DL><DT><B>Returns:</B><DD>an <code>InputStream</code> from which the raw data contained by      the <code>AttachmentPart</code> can be accessed.<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/xml/soap/SOAPException.html" title="class in javax.xml.soap">SOAPException</A></CODE> - if there is no content set into this       <code>AttachmentPart</code> object or if there was a data       transformation error.<DT><B>Since:</B></DT>  <DD>SAAJ 1.3</DD><DT><B>See Also:</B><DD><A HREF="../../../javax/xml/soap/AttachmentPart.html#getRawContentBytes()"><CODE>getRawContentBytes()</CODE></A></DL></DD></DL><HR><A NAME="getRawContentBytes()"><!-- --></A><H3>getRawContentBytes</H3><PRE>public abstract byte[] <B>getRawContentBytes</B>()                                   throws <A HREF="../../../javax/xml/soap/SOAPException.html" title="class in javax.xml.soap">SOAPException</A></PRE><DL><DD>Gets the content of this <code>AttachmentPart</code> object as a  byte[] array as if a call had been made to <code>getContent</code> and no <code>DataContentHandler</code> had been registered for the  <code>content-type</code> of this <code>AttachmentPart</code>.<P><DD><DL><DT><B>Returns:</B><DD>a <code>byte[]</code> array containing the raw data of the       <code>AttachmentPart</code>.<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/xml/soap/SOAPException.html" title="class in javax.xml.soap">SOAPException</A></CODE> - if there is no content set into this       <code>AttachmentPart</code> object or if there was a data       transformation error.<DT><B>Since:</B></DT>  <DD>SAAJ 1.3</DD></DL></DD></DL><HR><A NAME="getBase64Content()"><!-- --></A><H3>getBase64Content</H3><PRE>public abstract <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/io/InputStream.html" title="class or interface in java.io">InputStream</A> <B>getBase64Content</B>()                                      throws <A HREF="../../../javax/xml/soap/SOAPException.html" title="class in javax.xml.soap">SOAPException</A></PRE><DL><DD>Returns an <code>InputStream</code> which can be used to obtain the  content of <code>AttachmentPart</code>  as Base64 encoded  character data, this method would base64 encode the raw bytes  of the attachment and return.<P><DD><DL><DT><B>Returns:</B><DD>an <code>InputStream</code> from which the Base64 encoded       <code>AttachmentPart</code> can be read.<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/xml/soap/SOAPException.html" title="class in javax.xml.soap">SOAPException</A></CODE> - if there is no content set into this       <code>AttachmentPart</code> object or if there was a data       transformation error.<DT><B>Since:</B></DT>  <DD>SAAJ 1.3</DD></DL></DD></DL><HR><A NAME="setContent(java.lang.Object, java.lang.String)"><!-- --></A><H3>setContent</H3><PRE>public abstract void <B>setContent</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>&nbsp;object,                                <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;contentType)</PRE><DL><DD>Sets the content of this attachment part to that of the given  <code>Object</code> and sets the value of the <code>Content-Type</code> header to the given type. The type of the <code>Object</code> should correspond to the value given for the <code>Content-Type</code>. This depends on the particular set of <code>DataContentHandler</code> objects in use.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>object</CODE> - the Java object that makes up the content for               this attachment part<DD><CODE>contentType</CODE> - the MIME string that specifies the type of                  the content<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - may be thrown if the contentType             does not match the type of the content object, or if there            was no <code>DataContentHandler</code> object for this            content object<DT><B>See Also:</B><DD><A HREF="../../../javax/xml/soap/AttachmentPart.html#getContent()"><CODE>getContent()</CODE></A></DL></DD></DL><HR><A NAME="setRawContent(java.io.InputStream, java.lang.String)"><!-- --></A><H3>setRawContent</H3><PRE>public abstract void <B>setRawContent</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/io/InputStream.html" title="class or interface in java.io">InputStream</A>&nbsp;content,                                   <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;contentType)                            throws <A HREF="../../../javax/xml/soap/SOAPException.html" title="class in javax.xml.soap">SOAPException</A></PRE><DL><DD>Sets the content of this attachment part to that contained by the <code>InputStream</code> <code>content</code> and sets the value of the <code>Content-Type</code> header to the value contained in  <code>contentType</code>. <P>  A subsequent call to getSize() may not be an exact measure   of the content size.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>content</CODE> - the raw data to add to the attachment part<DD><CODE>contentType</CODE> - the value to set into the <code>Content-Type</code>  header<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/xml/soap/SOAPException.html" title="class in javax.xml.soap">SOAPException</A></CODE> - if an there is an error in setting the content<DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang">NullPointerException</A></CODE> - if <code>content</code> is null<DT><B>Since:</B></DT>  <DD>SAAJ 1.3</DD></DL></DD></DL><HR><A NAME="setRawContentBytes(byte[], int, int, java.lang.String)"><!-- --></A><H3>setRawContentBytes</H3><PRE>public abstract void <B>setRawContentBytes</B>(byte[]&nbsp;content,                                        int&nbsp;offset,                                        int&nbsp;len,                                        <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;contentType)                                 throws <A HREF="../../../javax/xml/soap/SOAPException.html" title="class in javax.xml.soap">SOAPException</A></PRE><DL><DD>Sets the content of this attachment part to that contained by the <code>byte[]</code> array <code>content</code> and sets the value of the <code>Content-Type</code> header to the value contained in  <code>contentType</code>.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>content</CODE> - the raw data to add to the attachment part<DD><CODE>contentType</CODE> - the value to set into the <code>Content-Type</code>  header<DD><CODE>offset</CODE> - the offset in the byte array of the content<DD><CODE>len</CODE> - the number of bytes that form the content<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/xml/soap/SOAPException.html" title="class in javax.xml.soap">SOAPException</A></CODE> - if an there is an error in setting the content  or content is null<DT><B>Since:</B></DT>  <DD>SAAJ 1.3</DD></DL></DD></DL><HR><A NAME="setBase64Content(java.io.InputStream, java.lang.String)"><!-- --></A><H3>setBase64Content</H3><PRE>public abstract void <B>setBase64Content</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/io/InputStream.html" title="class or interface in java.io">InputStream</A>&nbsp;content,                                      <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;contentType)                               throws <A HREF="../../../javax/xml/soap/SOAPException.html" title="class in javax.xml.soap">SOAPException</A></PRE><DL><DD>Sets the content of this attachment part from the Base64 source <code>InputStream</code>  and sets the value of the <code>Content-Type</code> header to the value contained in  <code>contentType</code>, This method would first decode the base64  input and write the resulting raw bytes to the attachment.  <P>  A subsequent call to getSize() may not be an exact measure   of the content size.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>content</CODE> - the base64 encoded data to add to the attachment part<DD><CODE>contentType</CODE> - the value to set into the <code>Content-Type</code>  header<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/xml/soap/SOAPException.html" title="class in javax.xml.soap">SOAPException</A></CODE> - if an there is an error in setting the content<DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang">NullPointerException</A></CODE> - if <code>content</code> is null<DT><B>Since:</B></DT>  <DD>SAAJ 1.3</DD></DL></DD></DL><HR><A NAME="getDataHandler()"><!-- --></A><H3>getDataHandler</H3><PRE>public abstract <A HREF="../../../javax/activation/DataHandler.html" title="class in javax.activation">DataHandler</A> <B>getDataHandler</B>()                                    throws <A HREF="../../../javax/xml/soap/SOAPException.html" title="class in javax.xml.soap">SOAPException</A></PRE><DL><DD>Gets the <code>DataHandler</code> object for this <code>AttachmentPart</code> object.<P><DD><DL><DT><B>Returns:</B><DD>the <code>DataHandler</code> object associated with this         <code>AttachmentPart</code> object<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/xml/soap/SOAPException.html" title="class in javax.xml.soap">SOAPException</A></CODE> - if there is no data in this <code>AttachmentPart</code> object</DL></DD></DL><HR><A NAME="setDataHandler(javax.activation.DataHandler)"><!-- --></A><H3>setDataHandler</H3><PRE>public abstract void <B>setDataHandler</B>(<A HREF="../../../javax/activation/DataHandler.html" title="class in javax.activation">DataHandler</A>&nbsp;dataHandler)</PRE><DL><DD>Sets the given <code>DataHandler</code> object as the data handler for this <code>AttachmentPart</code> object. Typically, on an incoming message, the data handler is automatically set. When a message is being created and populated with content, the <code>setDataHandler</code> method can be used to get data from various data sources into the message.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>dataHandler</CODE> - the <code>DataHandler</code> object to be set<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if there was a problem with            the specified <code>DataHandler</code> object</DL></DD></DL><HR><A NAME="getContentId()"><!-- --></A><H3>getContentId</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getContentId</B>()</PRE><DL><DD>Gets the value of the MIME header whose name is "Content-ID".<P><DD><DL><DT><B>Returns:</B><DD>a <code>String</code> giving the value of the          "Content-ID" header or <code>null</code> if there          is none<DT><B>See Also:</B><DD><A HREF="../../../javax/xml/soap/AttachmentPart.html#setContentId(java.lang.String)"><CODE>setContentId(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="getContentLocation()"><!-- --></A><H3>getContentLocation</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getContentLocation</B>()</PRE><DL><DD>Gets the value of the MIME header whose name is "Content-Location".<P><DD><DL><DT><B>Returns:</B><DD>a <code>String</code> giving the value of the

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?