jaxws/src/share/classes/javax/xml/soap/AttachmentPart.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 8 474761f14bca
child 2678 57cf2a1c1a05
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8
474761f14bca Initial load
duke
parents:
diff changeset
     1
/*
474761f14bca Initial load
duke
parents:
diff changeset
     2
 * $Id: AttachmentPart.java,v 1.11 2005/08/17 08:13:01 vj135062 Exp $
474761f14bca Initial load
duke
parents:
diff changeset
     3
 * $Revision: 1.11 $
474761f14bca Initial load
duke
parents:
diff changeset
     4
 * $Date: 2005/08/17 08:13:01 $
474761f14bca Initial load
duke
parents:
diff changeset
     5
 */
474761f14bca Initial load
duke
parents:
diff changeset
     6
474761f14bca Initial load
duke
parents:
diff changeset
     7
/*
474761f14bca Initial load
duke
parents:
diff changeset
     8
 * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
474761f14bca Initial load
duke
parents:
diff changeset
     9
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
474761f14bca Initial load
duke
parents:
diff changeset
    10
 *
474761f14bca Initial load
duke
parents:
diff changeset
    11
 * This code is free software; you can redistribute it and/or modify it
474761f14bca Initial load
duke
parents:
diff changeset
    12
 * under the terms of the GNU General Public License version 2 only, as
474761f14bca Initial load
duke
parents:
diff changeset
    13
 * published by the Free Software Foundation.  Sun designates this
474761f14bca Initial load
duke
parents:
diff changeset
    14
 * particular file as subject to the "Classpath" exception as provided
474761f14bca Initial load
duke
parents:
diff changeset
    15
 * by Sun in the LICENSE file that accompanied this code.
474761f14bca Initial load
duke
parents:
diff changeset
    16
 *
474761f14bca Initial load
duke
parents:
diff changeset
    17
 * This code is distributed in the hope that it will be useful, but WITHOUT
474761f14bca Initial load
duke
parents:
diff changeset
    18
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
474761f14bca Initial load
duke
parents:
diff changeset
    19
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
474761f14bca Initial load
duke
parents:
diff changeset
    20
 * version 2 for more details (a copy is included in the LICENSE file that
474761f14bca Initial load
duke
parents:
diff changeset
    21
 * accompanied this code).
474761f14bca Initial load
duke
parents:
diff changeset
    22
 *
474761f14bca Initial load
duke
parents:
diff changeset
    23
 * You should have received a copy of the GNU General Public License version
474761f14bca Initial load
duke
parents:
diff changeset
    24
 * 2 along with this work; if not, write to the Free Software Foundation,
474761f14bca Initial load
duke
parents:
diff changeset
    25
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
474761f14bca Initial load
duke
parents:
diff changeset
    26
 *
474761f14bca Initial load
duke
parents:
diff changeset
    27
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
474761f14bca Initial load
duke
parents:
diff changeset
    28
 * CA 95054 USA or visit www.sun.com if you need additional information or
474761f14bca Initial load
duke
parents:
diff changeset
    29
 * have any questions.
474761f14bca Initial load
duke
parents:
diff changeset
    30
 */
474761f14bca Initial load
duke
parents:
diff changeset
    31
package javax.xml.soap;
474761f14bca Initial load
duke
parents:
diff changeset
    32
474761f14bca Initial load
duke
parents:
diff changeset
    33
import java.io.InputStream;
474761f14bca Initial load
duke
parents:
diff changeset
    34
import java.io.Reader;
474761f14bca Initial load
duke
parents:
diff changeset
    35
import java.util.Iterator;
474761f14bca Initial load
duke
parents:
diff changeset
    36
474761f14bca Initial load
duke
parents:
diff changeset
    37
import javax.activation.DataHandler;
474761f14bca Initial load
duke
parents:
diff changeset
    38
474761f14bca Initial load
duke
parents:
diff changeset
    39
/**
474761f14bca Initial load
duke
parents:
diff changeset
    40
 * A single attachment to a <code>SOAPMessage</code> object. A <code>SOAPMessage</code>
474761f14bca Initial load
duke
parents:
diff changeset
    41
 * object may contain zero, one, or many <code>AttachmentPart</code> objects.
474761f14bca Initial load
duke
parents:
diff changeset
    42
 * Each <code>AttachmentPart</code> object consists of two parts,
474761f14bca Initial load
duke
parents:
diff changeset
    43
 * application-specific content and associated MIME headers. The
474761f14bca Initial load
duke
parents:
diff changeset
    44
 * MIME headers consists of name/value pairs that can be used to
474761f14bca Initial load
duke
parents:
diff changeset
    45
 * identify and describe the content.
474761f14bca Initial load
duke
parents:
diff changeset
    46
 * <p>
474761f14bca Initial load
duke
parents:
diff changeset
    47
 * An <code>AttachmentPart</code> object must conform to certain standards.
474761f14bca Initial load
duke
parents:
diff changeset
    48
 * <OL>
474761f14bca Initial load
duke
parents:
diff changeset
    49
 * <LI>It must conform to <a href="http://www.ietf.org/rfc/rfc2045.txt">
474761f14bca Initial load
duke
parents:
diff changeset
    50
 *     MIME [RFC2045] standards</a>
474761f14bca Initial load
duke
parents:
diff changeset
    51
 * <LI>It MUST contain content
474761f14bca Initial load
duke
parents:
diff changeset
    52
 * <LI>The header portion MUST include the following header:
474761f14bca Initial load
duke
parents:
diff changeset
    53
 *  <UL>
474761f14bca Initial load
duke
parents:
diff changeset
    54
 *   <LI><code>Content-Type</code><br>
474761f14bca Initial load
duke
parents:
diff changeset
    55
 *       This header identifies the type of data in the content of an
474761f14bca Initial load
duke
parents:
diff changeset
    56
 *       <code>AttachmentPart</code> object and MUST conform to [RFC2045].
474761f14bca Initial load
duke
parents:
diff changeset
    57
 *       The following is an example of a Content-Type header:
474761f14bca Initial load
duke
parents:
diff changeset
    58
 *       <PRE>
474761f14bca Initial load
duke
parents:
diff changeset
    59
 *       Content-Type:  application/xml
474761f14bca Initial load
duke
parents:
diff changeset
    60
 *       </PRE>
474761f14bca Initial load
duke
parents:
diff changeset
    61
 *       The following line of code, in which <code>ap</code> is an
474761f14bca Initial load
duke
parents:
diff changeset
    62
 *       <code>AttachmentPart</code> object, sets the header shown in
474761f14bca Initial load
duke
parents:
diff changeset
    63
 *       the previous example.
474761f14bca Initial load
duke
parents:
diff changeset
    64
 *       <PRE>
474761f14bca Initial load
duke
parents:
diff changeset
    65
 *       ap.setMimeHeader("Content-Type", "application/xml");
474761f14bca Initial load
duke
parents:
diff changeset
    66
 *       </PRE>
474761f14bca Initial load
duke
parents:
diff changeset
    67
 * <p>
474761f14bca Initial load
duke
parents:
diff changeset
    68
 *  </UL>
474761f14bca Initial load
duke
parents:
diff changeset
    69
 * </OL>
474761f14bca Initial load
duke
parents:
diff changeset
    70
 * <p>
474761f14bca Initial load
duke
parents:
diff changeset
    71
 * There are no restrictions on the content portion of an <code>
474761f14bca Initial load
duke
parents:
diff changeset
    72
 * AttachmentPart</code> object. The content may be anything from a
474761f14bca Initial load
duke
parents:
diff changeset
    73
 * simple plain text object to a complex XML document or image file.
474761f14bca Initial load
duke
parents:
diff changeset
    74
 *
474761f14bca Initial load
duke
parents:
diff changeset
    75
 * <p>
474761f14bca Initial load
duke
parents:
diff changeset
    76
 * An <code>AttachmentPart</code> object is created with the method
474761f14bca Initial load
duke
parents:
diff changeset
    77
 * <code>SOAPMessage.createAttachmentPart</code>. After setting its MIME headers,
474761f14bca Initial load
duke
parents:
diff changeset
    78
 *  the <code>AttachmentPart</code> object is added to the message
474761f14bca Initial load
duke
parents:
diff changeset
    79
 * that created it with the method <code>SOAPMessage.addAttachmentPart</code>.
474761f14bca Initial load
duke
parents:
diff changeset
    80
 *
474761f14bca Initial load
duke
parents:
diff changeset
    81
 * <p>
474761f14bca Initial load
duke
parents:
diff changeset
    82
 * The following code fragment, in which <code>m</code> is a
474761f14bca Initial load
duke
parents:
diff changeset
    83
 * <code>SOAPMessage</code> object and <code>contentStringl</code> is a
474761f14bca Initial load
duke
parents:
diff changeset
    84
 * <code>String</code>, creates an instance of <code>AttachmentPart</code>,
474761f14bca Initial load
duke
parents:
diff changeset
    85
 * sets the <code>AttachmentPart</code> object with some content and
474761f14bca Initial load
duke
parents:
diff changeset
    86
 * header information, and adds the <code>AttachmentPart</code> object to
474761f14bca Initial load
duke
parents:
diff changeset
    87
 * the <code>SOAPMessage</code> object.
474761f14bca Initial load
duke
parents:
diff changeset
    88
 * <PRE>
474761f14bca Initial load
duke
parents:
diff changeset
    89
 *     AttachmentPart ap1 = m.createAttachmentPart();
474761f14bca Initial load
duke
parents:
diff changeset
    90
 *     ap1.setContent(contentString1, "text/plain");
474761f14bca Initial load
duke
parents:
diff changeset
    91
 *     m.addAttachmentPart(ap1);
474761f14bca Initial load
duke
parents:
diff changeset
    92
 * </PRE>
474761f14bca Initial load
duke
parents:
diff changeset
    93
 *
474761f14bca Initial load
duke
parents:
diff changeset
    94
 *
474761f14bca Initial load
duke
parents:
diff changeset
    95
 * <p>
474761f14bca Initial load
duke
parents:
diff changeset
    96
 * The following code fragment creates and adds a second
474761f14bca Initial load
duke
parents:
diff changeset
    97
 * <code>AttachmentPart</code> instance to the same message. <code>jpegData</code>
474761f14bca Initial load
duke
parents:
diff changeset
    98
 * is a binary byte buffer representing the jpeg file.
474761f14bca Initial load
duke
parents:
diff changeset
    99
 * <PRE>
474761f14bca Initial load
duke
parents:
diff changeset
   100
 *     AttachmentPart ap2 = m.createAttachmentPart();
474761f14bca Initial load
duke
parents:
diff changeset
   101
 *     byte[] jpegData =  ...;
474761f14bca Initial load
duke
parents:
diff changeset
   102
 *     ap2.setContent(new ByteArrayInputStream(jpegData), "image/jpeg");
474761f14bca Initial load
duke
parents:
diff changeset
   103
 *     m.addAttachmentPart(ap2);
474761f14bca Initial load
duke
parents:
diff changeset
   104
 * </PRE>
474761f14bca Initial load
duke
parents:
diff changeset
   105
 * <p>
474761f14bca Initial load
duke
parents:
diff changeset
   106
 * The <code>getContent</code> method retrieves the contents and header from
474761f14bca Initial load
duke
parents:
diff changeset
   107
 * an <code>AttachmentPart</code> object. Depending on the
474761f14bca Initial load
duke
parents:
diff changeset
   108
 * <code>DataContentHandler</code> objects present, the returned
474761f14bca Initial load
duke
parents:
diff changeset
   109
 * <code>Object</code> can either be a typed Java object corresponding
474761f14bca Initial load
duke
parents:
diff changeset
   110
 * to the MIME type or an <code>InputStream</code> object that contains the
474761f14bca Initial load
duke
parents:
diff changeset
   111
 * content as bytes.
474761f14bca Initial load
duke
parents:
diff changeset
   112
 * <PRE>
474761f14bca Initial load
duke
parents:
diff changeset
   113
 *     String content1 = ap1.getContent();
474761f14bca Initial load
duke
parents:
diff changeset
   114
 *     java.io.InputStream content2 = ap2.getContent();
474761f14bca Initial load
duke
parents:
diff changeset
   115
 * </PRE>
474761f14bca Initial load
duke
parents:
diff changeset
   116
 *
474761f14bca Initial load
duke
parents:
diff changeset
   117
 * The method <code>clearContent</code> removes all the content from an
474761f14bca Initial load
duke
parents:
diff changeset
   118
 * <code>AttachmentPart</code> object but does not affect its header information.
474761f14bca Initial load
duke
parents:
diff changeset
   119
 * <PRE>
474761f14bca Initial load
duke
parents:
diff changeset
   120
 *     ap1.clearContent();
474761f14bca Initial load
duke
parents:
diff changeset
   121
 * </PRE>
474761f14bca Initial load
duke
parents:
diff changeset
   122
 */
474761f14bca Initial load
duke
parents:
diff changeset
   123
474761f14bca Initial load
duke
parents:
diff changeset
   124
public abstract class AttachmentPart {
474761f14bca Initial load
duke
parents:
diff changeset
   125
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   126
     * Returns the number of bytes in this <code>AttachmentPart</code>
474761f14bca Initial load
duke
parents:
diff changeset
   127
     * object.
474761f14bca Initial load
duke
parents:
diff changeset
   128
     *
474761f14bca Initial load
duke
parents:
diff changeset
   129
     * @return the size of this <code>AttachmentPart</code> object in bytes
474761f14bca Initial load
duke
parents:
diff changeset
   130
     *         or -1 if the size cannot be determined
474761f14bca Initial load
duke
parents:
diff changeset
   131
     * @exception SOAPException if the content of this attachment is
474761f14bca Initial load
duke
parents:
diff changeset
   132
     *            corrupted of if there was an exception while trying
474761f14bca Initial load
duke
parents:
diff changeset
   133
     *            to determine the size.
474761f14bca Initial load
duke
parents:
diff changeset
   134
     */
474761f14bca Initial load
duke
parents:
diff changeset
   135
    public abstract int getSize() throws SOAPException;
474761f14bca Initial load
duke
parents:
diff changeset
   136
474761f14bca Initial load
duke
parents:
diff changeset
   137
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   138
     * Clears out the content of this <code>AttachmentPart</code> object.
474761f14bca Initial load
duke
parents:
diff changeset
   139
     * The MIME header portion is left untouched.
474761f14bca Initial load
duke
parents:
diff changeset
   140
     */
474761f14bca Initial load
duke
parents:
diff changeset
   141
    public abstract void clearContent();
474761f14bca Initial load
duke
parents:
diff changeset
   142
474761f14bca Initial load
duke
parents:
diff changeset
   143
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   144
     * Gets the content of this <code>AttachmentPart</code> object as a Java
474761f14bca Initial load
duke
parents:
diff changeset
   145
     * object. The type of the returned Java object depends on (1) the
474761f14bca Initial load
duke
parents:
diff changeset
   146
     * <code>DataContentHandler</code> object that is used to interpret the bytes
474761f14bca Initial load
duke
parents:
diff changeset
   147
     * and (2) the <code>Content-Type</code> given in the header.
474761f14bca Initial load
duke
parents:
diff changeset
   148
     * <p>
474761f14bca Initial load
duke
parents:
diff changeset
   149
     * For the MIME content types "text/plain", "text/html" and "text/xml", the
474761f14bca Initial load
duke
parents:
diff changeset
   150
     * <code>DataContentHandler</code> object does the conversions to and
474761f14bca Initial load
duke
parents:
diff changeset
   151
     * from the Java types corresponding to the MIME types.
474761f14bca Initial load
duke
parents:
diff changeset
   152
     * For other MIME types,the <code>DataContentHandler</code> object
474761f14bca Initial load
duke
parents:
diff changeset
   153
     * can return an <code>InputStream</code> object that contains the content data
474761f14bca Initial load
duke
parents:
diff changeset
   154
     * as raw bytes.
474761f14bca Initial load
duke
parents:
diff changeset
   155
     * <p>
474761f14bca Initial load
duke
parents:
diff changeset
   156
     * A SAAJ-compliant implementation must, as a minimum, return a
474761f14bca Initial load
duke
parents:
diff changeset
   157
     * <code>java.lang.String</code> object corresponding to any content
474761f14bca Initial load
duke
parents:
diff changeset
   158
     * stream with a <code>Content-Type</code> value of
474761f14bca Initial load
duke
parents:
diff changeset
   159
     * <code>text/plain</code>, a
474761f14bca Initial load
duke
parents:
diff changeset
   160
     * <code>javax.xml.transform.stream.StreamSource</code> object corresponding to a
474761f14bca Initial load
duke
parents:
diff changeset
   161
     * content stream with a <code>Content-Type</code> value of
474761f14bca Initial load
duke
parents:
diff changeset
   162
     * <code>text/xml</code>, a <code>java.awt.Image</code> object
474761f14bca Initial load
duke
parents:
diff changeset
   163
     * corresponding to a content stream with a
474761f14bca Initial load
duke
parents:
diff changeset
   164
     * <code>Content-Type</code> value of <code>image/gif</code> or
474761f14bca Initial load
duke
parents:
diff changeset
   165
     * <code>image/jpeg</code>.  For those content types that an
474761f14bca Initial load
duke
parents:
diff changeset
   166
     * installed <code>DataContentHandler</code> object does not understand, the
474761f14bca Initial load
duke
parents:
diff changeset
   167
     * <code>DataContentHandler</code> object is required to return a
474761f14bca Initial load
duke
parents:
diff changeset
   168
     * <code>java.io.InputStream</code> object with the raw bytes.
474761f14bca Initial load
duke
parents:
diff changeset
   169
     *
474761f14bca Initial load
duke
parents:
diff changeset
   170
     * @return a Java object with the content of this <code>AttachmentPart</code>
474761f14bca Initial load
duke
parents:
diff changeset
   171
     *         object
474761f14bca Initial load
duke
parents:
diff changeset
   172
     *
474761f14bca Initial load
duke
parents:
diff changeset
   173
     * @exception SOAPException if there is no content set into this
474761f14bca Initial load
duke
parents:
diff changeset
   174
     *            <code>AttachmentPart</code> object or if there was a data
474761f14bca Initial load
duke
parents:
diff changeset
   175
     *            transformation error
474761f14bca Initial load
duke
parents:
diff changeset
   176
     */
474761f14bca Initial load
duke
parents:
diff changeset
   177
    public abstract Object getContent() throws SOAPException;
474761f14bca Initial load
duke
parents:
diff changeset
   178
474761f14bca Initial load
duke
parents:
diff changeset
   179
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   180
     * Gets the content of this <code>AttachmentPart</code> object as an
474761f14bca Initial load
duke
parents:
diff changeset
   181
     * InputStream as if a call had been made to <code>getContent</code> and no
474761f14bca Initial load
duke
parents:
diff changeset
   182
     * <code>DataContentHandler</code> had been registered for the
474761f14bca Initial load
duke
parents:
diff changeset
   183
     * <code>content-type</code> of this <code>AttachmentPart</code>.
474761f14bca Initial load
duke
parents:
diff changeset
   184
     *<p>
474761f14bca Initial load
duke
parents:
diff changeset
   185
     * Note that reading from the returned InputStream would result in consuming
474761f14bca Initial load
duke
parents:
diff changeset
   186
     * the data in the stream. It is the responsibility of the caller to reset
474761f14bca Initial load
duke
parents:
diff changeset
   187
     * the InputStream appropriately before calling a Subsequent API. If a copy
474761f14bca Initial load
duke
parents:
diff changeset
   188
     * of the raw attachment content is required then the {@link #getRawContentBytes} API
474761f14bca Initial load
duke
parents:
diff changeset
   189
     * should be used instead.
474761f14bca Initial load
duke
parents:
diff changeset
   190
     *
474761f14bca Initial load
duke
parents:
diff changeset
   191
     * @return an <code>InputStream</code> from which the raw data contained by
474761f14bca Initial load
duke
parents:
diff changeset
   192
     *      the <code>AttachmentPart</code> can be accessed.
474761f14bca Initial load
duke
parents:
diff changeset
   193
     *
474761f14bca Initial load
duke
parents:
diff changeset
   194
     * @throws SOAPException if there is no content set into this
474761f14bca Initial load
duke
parents:
diff changeset
   195
     *      <code>AttachmentPart</code> object or if there was a data
474761f14bca Initial load
duke
parents:
diff changeset
   196
     *      transformation error.
474761f14bca Initial load
duke
parents:
diff changeset
   197
     *
474761f14bca Initial load
duke
parents:
diff changeset
   198
     * @since SAAJ 1.3
474761f14bca Initial load
duke
parents:
diff changeset
   199
     * @see #getRawContentBytes
474761f14bca Initial load
duke
parents:
diff changeset
   200
     */
474761f14bca Initial load
duke
parents:
diff changeset
   201
    public abstract InputStream getRawContent() throws SOAPException;
474761f14bca Initial load
duke
parents:
diff changeset
   202
474761f14bca Initial load
duke
parents:
diff changeset
   203
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   204
     * Gets the content of this <code>AttachmentPart</code> object as a
474761f14bca Initial load
duke
parents:
diff changeset
   205
     * byte[] array as if a call had been made to <code>getContent</code> and no
474761f14bca Initial load
duke
parents:
diff changeset
   206
     * <code>DataContentHandler</code> had been registered for the
474761f14bca Initial load
duke
parents:
diff changeset
   207
     * <code>content-type</code> of this <code>AttachmentPart</code>.
474761f14bca Initial load
duke
parents:
diff changeset
   208
     *
474761f14bca Initial load
duke
parents:
diff changeset
   209
     * @return a <code>byte[]</code> array containing the raw data of the
474761f14bca Initial load
duke
parents:
diff changeset
   210
     *      <code>AttachmentPart</code>.
474761f14bca Initial load
duke
parents:
diff changeset
   211
     *
474761f14bca Initial load
duke
parents:
diff changeset
   212
     * @throws SOAPException if there is no content set into this
474761f14bca Initial load
duke
parents:
diff changeset
   213
     *      <code>AttachmentPart</code> object or if there was a data
474761f14bca Initial load
duke
parents:
diff changeset
   214
     *      transformation error.
474761f14bca Initial load
duke
parents:
diff changeset
   215
     *
474761f14bca Initial load
duke
parents:
diff changeset
   216
     * @since SAAJ 1.3
474761f14bca Initial load
duke
parents:
diff changeset
   217
     */
474761f14bca Initial load
duke
parents:
diff changeset
   218
    public abstract byte[] getRawContentBytes() throws SOAPException;
474761f14bca Initial load
duke
parents:
diff changeset
   219
474761f14bca Initial load
duke
parents:
diff changeset
   220
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   221
     * Returns an <code>InputStream</code> which can be used to obtain the
474761f14bca Initial load
duke
parents:
diff changeset
   222
     * content of <code>AttachmentPart</code>  as Base64 encoded
474761f14bca Initial load
duke
parents:
diff changeset
   223
     * character data, this method would base64 encode the raw bytes
474761f14bca Initial load
duke
parents:
diff changeset
   224
     * of the attachment and return.
474761f14bca Initial load
duke
parents:
diff changeset
   225
     *
474761f14bca Initial load
duke
parents:
diff changeset
   226
     * @return an <code>InputStream</code> from which the Base64 encoded
474761f14bca Initial load
duke
parents:
diff changeset
   227
     *       <code>AttachmentPart</code> can be read.
474761f14bca Initial load
duke
parents:
diff changeset
   228
     *
474761f14bca Initial load
duke
parents:
diff changeset
   229
     * @throws SOAPException if there is no content set into this
474761f14bca Initial load
duke
parents:
diff changeset
   230
     *      <code>AttachmentPart</code> object or if there was a data
474761f14bca Initial load
duke
parents:
diff changeset
   231
     *      transformation error.
474761f14bca Initial load
duke
parents:
diff changeset
   232
     *
474761f14bca Initial load
duke
parents:
diff changeset
   233
     * @since SAAJ 1.3
474761f14bca Initial load
duke
parents:
diff changeset
   234
     */
474761f14bca Initial load
duke
parents:
diff changeset
   235
    public abstract InputStream getBase64Content() throws SOAPException;
474761f14bca Initial load
duke
parents:
diff changeset
   236
474761f14bca Initial load
duke
parents:
diff changeset
   237
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   238
     * Sets the content of this attachment part to that of the given
474761f14bca Initial load
duke
parents:
diff changeset
   239
     * <code>Object</code> and sets the value of the <code>Content-Type</code>
474761f14bca Initial load
duke
parents:
diff changeset
   240
     * header to the given type. The type of the
474761f14bca Initial load
duke
parents:
diff changeset
   241
     * <code>Object</code> should correspond to the value given for the
474761f14bca Initial load
duke
parents:
diff changeset
   242
     * <code>Content-Type</code>. This depends on the particular
474761f14bca Initial load
duke
parents:
diff changeset
   243
     * set of <code>DataContentHandler</code> objects in use.
474761f14bca Initial load
duke
parents:
diff changeset
   244
     *
474761f14bca Initial load
duke
parents:
diff changeset
   245
     *
474761f14bca Initial load
duke
parents:
diff changeset
   246
     * @param object the Java object that makes up the content for
474761f14bca Initial load
duke
parents:
diff changeset
   247
     *               this attachment part
474761f14bca Initial load
duke
parents:
diff changeset
   248
     * @param contentType the MIME string that specifies the type of
474761f14bca Initial load
duke
parents:
diff changeset
   249
     *                  the content
474761f14bca Initial load
duke
parents:
diff changeset
   250
     *
474761f14bca Initial load
duke
parents:
diff changeset
   251
     * @exception IllegalArgumentException may be thrown if the contentType
474761f14bca Initial load
duke
parents:
diff changeset
   252
     *            does not match the type of the content object, or if there
474761f14bca Initial load
duke
parents:
diff changeset
   253
     *            was no <code>DataContentHandler</code> object for this
474761f14bca Initial load
duke
parents:
diff changeset
   254
     *            content object
474761f14bca Initial load
duke
parents:
diff changeset
   255
     *
474761f14bca Initial load
duke
parents:
diff changeset
   256
     * @see #getContent
474761f14bca Initial load
duke
parents:
diff changeset
   257
     */
474761f14bca Initial load
duke
parents:
diff changeset
   258
    public abstract void setContent(Object object, String contentType);
474761f14bca Initial load
duke
parents:
diff changeset
   259
474761f14bca Initial load
duke
parents:
diff changeset
   260
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   261
     * Sets the content of this attachment part to that contained by the
474761f14bca Initial load
duke
parents:
diff changeset
   262
     * <code>InputStream</code> <code>content</code> and sets the value of the
474761f14bca Initial load
duke
parents:
diff changeset
   263
     * <code>Content-Type</code> header to the value contained in
474761f14bca Initial load
duke
parents:
diff changeset
   264
     * <code>contentType</code>.
474761f14bca Initial load
duke
parents:
diff changeset
   265
     * <P>
474761f14bca Initial load
duke
parents:
diff changeset
   266
     *  A subsequent call to getSize() may not be an exact measure
474761f14bca Initial load
duke
parents:
diff changeset
   267
     *  of the content size.
474761f14bca Initial load
duke
parents:
diff changeset
   268
     *
474761f14bca Initial load
duke
parents:
diff changeset
   269
     * @param content the raw data to add to the attachment part
474761f14bca Initial load
duke
parents:
diff changeset
   270
     * @param contentType the value to set into the <code>Content-Type</code>
474761f14bca Initial load
duke
parents:
diff changeset
   271
     * header
474761f14bca Initial load
duke
parents:
diff changeset
   272
     *
474761f14bca Initial load
duke
parents:
diff changeset
   273
     * @exception SOAPException if an there is an error in setting the content
474761f14bca Initial load
duke
parents:
diff changeset
   274
     * @exception NullPointerException if <code>content</code> is null
474761f14bca Initial load
duke
parents:
diff changeset
   275
     * @since SAAJ 1.3
474761f14bca Initial load
duke
parents:
diff changeset
   276
     */
474761f14bca Initial load
duke
parents:
diff changeset
   277
    public abstract void setRawContent(InputStream content, String contentType) throws SOAPException;
474761f14bca Initial load
duke
parents:
diff changeset
   278
474761f14bca Initial load
duke
parents:
diff changeset
   279
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   280
     * Sets the content of this attachment part to that contained by the
474761f14bca Initial load
duke
parents:
diff changeset
   281
     * <code>byte[]</code> array <code>content</code> and sets the value of the
474761f14bca Initial load
duke
parents:
diff changeset
   282
     * <code>Content-Type</code> header to the value contained in
474761f14bca Initial load
duke
parents:
diff changeset
   283
     * <code>contentType</code>.
474761f14bca Initial load
duke
parents:
diff changeset
   284
     *
474761f14bca Initial load
duke
parents:
diff changeset
   285
     * @param content the raw data to add to the attachment part
474761f14bca Initial load
duke
parents:
diff changeset
   286
     * @param contentType the value to set into the <code>Content-Type</code>
474761f14bca Initial load
duke
parents:
diff changeset
   287
     * header
474761f14bca Initial load
duke
parents:
diff changeset
   288
     * @param offset the offset in the byte array of the content
474761f14bca Initial load
duke
parents:
diff changeset
   289
     * @param len the number of bytes that form the content
474761f14bca Initial load
duke
parents:
diff changeset
   290
     *
474761f14bca Initial load
duke
parents:
diff changeset
   291
     * @exception SOAPException if an there is an error in setting the content
474761f14bca Initial load
duke
parents:
diff changeset
   292
     * or content is null
474761f14bca Initial load
duke
parents:
diff changeset
   293
     * @since SAAJ 1.3
474761f14bca Initial load
duke
parents:
diff changeset
   294
     */
474761f14bca Initial load
duke
parents:
diff changeset
   295
    public abstract void setRawContentBytes(
474761f14bca Initial load
duke
parents:
diff changeset
   296
        byte[] content, int offset, int len,  String contentType)
474761f14bca Initial load
duke
parents:
diff changeset
   297
        throws SOAPException;
474761f14bca Initial load
duke
parents:
diff changeset
   298
474761f14bca Initial load
duke
parents:
diff changeset
   299
474761f14bca Initial load
duke
parents:
diff changeset
   300
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   301
     * Sets the content of this attachment part from the Base64 source
474761f14bca Initial load
duke
parents:
diff changeset
   302
     * <code>InputStream</code>  and sets the value of the
474761f14bca Initial load
duke
parents:
diff changeset
   303
     * <code>Content-Type</code> header to the value contained in
474761f14bca Initial load
duke
parents:
diff changeset
   304
     * <code>contentType</code>, This method would first decode the base64
474761f14bca Initial load
duke
parents:
diff changeset
   305
     * input and write the resulting raw bytes to the attachment.
474761f14bca Initial load
duke
parents:
diff changeset
   306
     * <P>
474761f14bca Initial load
duke
parents:
diff changeset
   307
     *  A subsequent call to getSize() may not be an exact measure
474761f14bca Initial load
duke
parents:
diff changeset
   308
     *  of the content size.
474761f14bca Initial load
duke
parents:
diff changeset
   309
     *
474761f14bca Initial load
duke
parents:
diff changeset
   310
     * @param content the base64 encoded data to add to the attachment part
474761f14bca Initial load
duke
parents:
diff changeset
   311
     * @param contentType the value to set into the <code>Content-Type</code>
474761f14bca Initial load
duke
parents:
diff changeset
   312
     * header
474761f14bca Initial load
duke
parents:
diff changeset
   313
     *
474761f14bca Initial load
duke
parents:
diff changeset
   314
     * @exception SOAPException if an there is an error in setting the content
474761f14bca Initial load
duke
parents:
diff changeset
   315
     * @exception NullPointerException if <code>content</code> is null
474761f14bca Initial load
duke
parents:
diff changeset
   316
     *
474761f14bca Initial load
duke
parents:
diff changeset
   317
     * @since SAAJ 1.3
474761f14bca Initial load
duke
parents:
diff changeset
   318
     */
474761f14bca Initial load
duke
parents:
diff changeset
   319
    public abstract void setBase64Content(
474761f14bca Initial load
duke
parents:
diff changeset
   320
        InputStream content, String contentType) throws SOAPException;
474761f14bca Initial load
duke
parents:
diff changeset
   321
474761f14bca Initial load
duke
parents:
diff changeset
   322
474761f14bca Initial load
duke
parents:
diff changeset
   323
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   324
     * Gets the <code>DataHandler</code> object for this <code>AttachmentPart</code>
474761f14bca Initial load
duke
parents:
diff changeset
   325
     * object.
474761f14bca Initial load
duke
parents:
diff changeset
   326
     *
474761f14bca Initial load
duke
parents:
diff changeset
   327
     * @return the <code>DataHandler</code> object associated with this
474761f14bca Initial load
duke
parents:
diff changeset
   328
     *         <code>AttachmentPart</code> object
474761f14bca Initial load
duke
parents:
diff changeset
   329
     *
474761f14bca Initial load
duke
parents:
diff changeset
   330
     * @exception SOAPException if there is no data in
474761f14bca Initial load
duke
parents:
diff changeset
   331
     * this <code>AttachmentPart</code> object
474761f14bca Initial load
duke
parents:
diff changeset
   332
     */
474761f14bca Initial load
duke
parents:
diff changeset
   333
    public abstract DataHandler getDataHandler()
474761f14bca Initial load
duke
parents:
diff changeset
   334
        throws SOAPException;
474761f14bca Initial load
duke
parents:
diff changeset
   335
474761f14bca Initial load
duke
parents:
diff changeset
   336
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   337
     * Sets the given <code>DataHandler</code> object as the data handler
474761f14bca Initial load
duke
parents:
diff changeset
   338
     * for this <code>AttachmentPart</code> object. Typically, on an incoming
474761f14bca Initial load
duke
parents:
diff changeset
   339
     * message, the data handler is automatically set. When
474761f14bca Initial load
duke
parents:
diff changeset
   340
     * a message is being created and populated with content, the
474761f14bca Initial load
duke
parents:
diff changeset
   341
     * <code>setDataHandler</code> method can be used to get data from
474761f14bca Initial load
duke
parents:
diff changeset
   342
     * various data sources into the message.
474761f14bca Initial load
duke
parents:
diff changeset
   343
     *
474761f14bca Initial load
duke
parents:
diff changeset
   344
     * @param dataHandler the <code>DataHandler</code> object to be set
474761f14bca Initial load
duke
parents:
diff changeset
   345
     *
474761f14bca Initial load
duke
parents:
diff changeset
   346
     * @exception IllegalArgumentException if there was a problem with
474761f14bca Initial load
duke
parents:
diff changeset
   347
     *            the specified <code>DataHandler</code> object
474761f14bca Initial load
duke
parents:
diff changeset
   348
     */
474761f14bca Initial load
duke
parents:
diff changeset
   349
    public abstract void setDataHandler(DataHandler dataHandler);
474761f14bca Initial load
duke
parents:
diff changeset
   350
474761f14bca Initial load
duke
parents:
diff changeset
   351
474761f14bca Initial load
duke
parents:
diff changeset
   352
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   353
     * Gets the value of the MIME header whose name is "Content-ID".
474761f14bca Initial load
duke
parents:
diff changeset
   354
     *
474761f14bca Initial load
duke
parents:
diff changeset
   355
     * @return a <code>String</code> giving the value of the
474761f14bca Initial load
duke
parents:
diff changeset
   356
     *          "Content-ID" header or <code>null</code> if there
474761f14bca Initial load
duke
parents:
diff changeset
   357
     *          is none
474761f14bca Initial load
duke
parents:
diff changeset
   358
     * @see #setContentId
474761f14bca Initial load
duke
parents:
diff changeset
   359
     */
474761f14bca Initial load
duke
parents:
diff changeset
   360
    public String getContentId() {
474761f14bca Initial load
duke
parents:
diff changeset
   361
        String[] values = getMimeHeader("Content-ID");
474761f14bca Initial load
duke
parents:
diff changeset
   362
        if (values != null && values.length > 0)
474761f14bca Initial load
duke
parents:
diff changeset
   363
            return values[0];
474761f14bca Initial load
duke
parents:
diff changeset
   364
        return null;
474761f14bca Initial load
duke
parents:
diff changeset
   365
    }
474761f14bca Initial load
duke
parents:
diff changeset
   366
474761f14bca Initial load
duke
parents:
diff changeset
   367
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   368
     * Gets the value of the MIME header whose name is "Content-Location".
474761f14bca Initial load
duke
parents:
diff changeset
   369
     *
474761f14bca Initial load
duke
parents:
diff changeset
   370
     * @return a <code>String</code> giving the value of the
474761f14bca Initial load
duke
parents:
diff changeset
   371
     *          "Content-Location" header or <code>null</code> if there
474761f14bca Initial load
duke
parents:
diff changeset
   372
     *          is none
474761f14bca Initial load
duke
parents:
diff changeset
   373
     */
474761f14bca Initial load
duke
parents:
diff changeset
   374
    public String getContentLocation() {
474761f14bca Initial load
duke
parents:
diff changeset
   375
        String[] values = getMimeHeader("Content-Location");
474761f14bca Initial load
duke
parents:
diff changeset
   376
        if (values != null && values.length > 0)
474761f14bca Initial load
duke
parents:
diff changeset
   377
            return values[0];
474761f14bca Initial load
duke
parents:
diff changeset
   378
        return null;
474761f14bca Initial load
duke
parents:
diff changeset
   379
    }
474761f14bca Initial load
duke
parents:
diff changeset
   380
474761f14bca Initial load
duke
parents:
diff changeset
   381
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   382
     * Gets the value of the MIME header whose name is "Content-Type".
474761f14bca Initial load
duke
parents:
diff changeset
   383
     *
474761f14bca Initial load
duke
parents:
diff changeset
   384
     * @return a <code>String</code> giving the value of the
474761f14bca Initial load
duke
parents:
diff changeset
   385
     *          "Content-Type" header or <code>null</code> if there
474761f14bca Initial load
duke
parents:
diff changeset
   386
     *          is none
474761f14bca Initial load
duke
parents:
diff changeset
   387
     */
474761f14bca Initial load
duke
parents:
diff changeset
   388
    public String getContentType() {
474761f14bca Initial load
duke
parents:
diff changeset
   389
        String[] values = getMimeHeader("Content-Type");
474761f14bca Initial load
duke
parents:
diff changeset
   390
        if (values != null && values.length > 0)
474761f14bca Initial load
duke
parents:
diff changeset
   391
            return values[0];
474761f14bca Initial load
duke
parents:
diff changeset
   392
        return null;
474761f14bca Initial load
duke
parents:
diff changeset
   393
    }
474761f14bca Initial load
duke
parents:
diff changeset
   394
474761f14bca Initial load
duke
parents:
diff changeset
   395
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   396
     * Sets the MIME header whose name is "Content-ID" with the given value.
474761f14bca Initial load
duke
parents:
diff changeset
   397
     *
474761f14bca Initial load
duke
parents:
diff changeset
   398
     * @param contentId a <code>String</code> giving the value of the
474761f14bca Initial load
duke
parents:
diff changeset
   399
     *          "Content-ID" header
474761f14bca Initial load
duke
parents:
diff changeset
   400
     *
474761f14bca Initial load
duke
parents:
diff changeset
   401
     * @exception IllegalArgumentException if there was a problem with
474761f14bca Initial load
duke
parents:
diff changeset
   402
     *            the specified <code>contentId</code> value
474761f14bca Initial load
duke
parents:
diff changeset
   403
     * @see #getContentId
474761f14bca Initial load
duke
parents:
diff changeset
   404
     */
474761f14bca Initial load
duke
parents:
diff changeset
   405
    public void setContentId(String contentId)
474761f14bca Initial load
duke
parents:
diff changeset
   406
    {
474761f14bca Initial load
duke
parents:
diff changeset
   407
        setMimeHeader("Content-ID", contentId);
474761f14bca Initial load
duke
parents:
diff changeset
   408
    }
474761f14bca Initial load
duke
parents:
diff changeset
   409
474761f14bca Initial load
duke
parents:
diff changeset
   410
474761f14bca Initial load
duke
parents:
diff changeset
   411
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   412
     * Sets the MIME header whose name is "Content-Location" with the given value.
474761f14bca Initial load
duke
parents:
diff changeset
   413
     *
474761f14bca Initial load
duke
parents:
diff changeset
   414
     *
474761f14bca Initial load
duke
parents:
diff changeset
   415
     * @param contentLocation a <code>String</code> giving the value of the
474761f14bca Initial load
duke
parents:
diff changeset
   416
     *          "Content-Location" header
474761f14bca Initial load
duke
parents:
diff changeset
   417
     * @exception IllegalArgumentException if there was a problem with
474761f14bca Initial load
duke
parents:
diff changeset
   418
     *            the specified content location
474761f14bca Initial load
duke
parents:
diff changeset
   419
     */
474761f14bca Initial load
duke
parents:
diff changeset
   420
    public void setContentLocation(String contentLocation)
474761f14bca Initial load
duke
parents:
diff changeset
   421
    {
474761f14bca Initial load
duke
parents:
diff changeset
   422
        setMimeHeader("Content-Location", contentLocation);
474761f14bca Initial load
duke
parents:
diff changeset
   423
    }
474761f14bca Initial load
duke
parents:
diff changeset
   424
474761f14bca Initial load
duke
parents:
diff changeset
   425
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   426
     * Sets the MIME header whose name is "Content-Type" with the given value.
474761f14bca Initial load
duke
parents:
diff changeset
   427
     *
474761f14bca Initial load
duke
parents:
diff changeset
   428
     * @param contentType a <code>String</code> giving the value of the
474761f14bca Initial load
duke
parents:
diff changeset
   429
     *          "Content-Type" header
474761f14bca Initial load
duke
parents:
diff changeset
   430
     *
474761f14bca Initial load
duke
parents:
diff changeset
   431
     * @exception IllegalArgumentException if there was a problem with
474761f14bca Initial load
duke
parents:
diff changeset
   432
     *            the specified content type
474761f14bca Initial load
duke
parents:
diff changeset
   433
     */
474761f14bca Initial load
duke
parents:
diff changeset
   434
    public void setContentType(String contentType)
474761f14bca Initial load
duke
parents:
diff changeset
   435
    {
474761f14bca Initial load
duke
parents:
diff changeset
   436
        setMimeHeader("Content-Type", contentType);
474761f14bca Initial load
duke
parents:
diff changeset
   437
    }
474761f14bca Initial load
duke
parents:
diff changeset
   438
474761f14bca Initial load
duke
parents:
diff changeset
   439
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   440
     * Removes all MIME headers that match the given name.
474761f14bca Initial load
duke
parents:
diff changeset
   441
     *
474761f14bca Initial load
duke
parents:
diff changeset
   442
     * @param header the string name of the MIME header/s to
474761f14bca Initial load
duke
parents:
diff changeset
   443
     *               be removed
474761f14bca Initial load
duke
parents:
diff changeset
   444
     */
474761f14bca Initial load
duke
parents:
diff changeset
   445
    public abstract void removeMimeHeader(String header);
474761f14bca Initial load
duke
parents:
diff changeset
   446
474761f14bca Initial load
duke
parents:
diff changeset
   447
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   448
     * Removes all the MIME header entries.
474761f14bca Initial load
duke
parents:
diff changeset
   449
     */
474761f14bca Initial load
duke
parents:
diff changeset
   450
    public abstract void removeAllMimeHeaders();
474761f14bca Initial load
duke
parents:
diff changeset
   451
474761f14bca Initial load
duke
parents:
diff changeset
   452
474761f14bca Initial load
duke
parents:
diff changeset
   453
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   454
     * Gets all the values of the header identified by the given
474761f14bca Initial load
duke
parents:
diff changeset
   455
     * <code>String</code>.
474761f14bca Initial load
duke
parents:
diff changeset
   456
     *
474761f14bca Initial load
duke
parents:
diff changeset
   457
     * @param name the name of the header; example: "Content-Type"
474761f14bca Initial load
duke
parents:
diff changeset
   458
     * @return a <code>String</code> array giving the value for the
474761f14bca Initial load
duke
parents:
diff changeset
   459
     *         specified header
474761f14bca Initial load
duke
parents:
diff changeset
   460
     * @see #setMimeHeader
474761f14bca Initial load
duke
parents:
diff changeset
   461
     */
474761f14bca Initial load
duke
parents:
diff changeset
   462
    public abstract String[] getMimeHeader(String name);
474761f14bca Initial load
duke
parents:
diff changeset
   463
474761f14bca Initial load
duke
parents:
diff changeset
   464
474761f14bca Initial load
duke
parents:
diff changeset
   465
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   466
     * Changes the first header entry that matches the given name
474761f14bca Initial load
duke
parents:
diff changeset
   467
     * to the given value, adding a new header if no existing header
474761f14bca Initial load
duke
parents:
diff changeset
   468
     * matches. This method also removes all matching headers but the first. <p>
474761f14bca Initial load
duke
parents:
diff changeset
   469
     *
474761f14bca Initial load
duke
parents:
diff changeset
   470
     * Note that RFC822 headers can only contain US-ASCII characters.
474761f14bca Initial load
duke
parents:
diff changeset
   471
     *
474761f14bca Initial load
duke
parents:
diff changeset
   472
     * @param   name    a <code>String</code> giving the name of the header
474761f14bca Initial load
duke
parents:
diff changeset
   473
     *                  for which to search
474761f14bca Initial load
duke
parents:
diff changeset
   474
     * @param   value   a <code>String</code> giving the value to be set for
474761f14bca Initial load
duke
parents:
diff changeset
   475
     *                  the header whose name matches the given name
474761f14bca Initial load
duke
parents:
diff changeset
   476
     *
474761f14bca Initial load
duke
parents:
diff changeset
   477
     * @exception IllegalArgumentException if there was a problem with
474761f14bca Initial load
duke
parents:
diff changeset
   478
     *            the specified mime header name or value
474761f14bca Initial load
duke
parents:
diff changeset
   479
     */
474761f14bca Initial load
duke
parents:
diff changeset
   480
    public abstract void setMimeHeader(String name, String value);
474761f14bca Initial load
duke
parents:
diff changeset
   481
474761f14bca Initial load
duke
parents:
diff changeset
   482
474761f14bca Initial load
duke
parents:
diff changeset
   483
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   484
     * Adds a MIME header with the specified name and value to this
474761f14bca Initial load
duke
parents:
diff changeset
   485
     * <code>AttachmentPart</code> object.
474761f14bca Initial load
duke
parents:
diff changeset
   486
     * <p>
474761f14bca Initial load
duke
parents:
diff changeset
   487
     * Note that RFC822 headers can contain only US-ASCII characters.
474761f14bca Initial load
duke
parents:
diff changeset
   488
     *
474761f14bca Initial load
duke
parents:
diff changeset
   489
     * @param   name    a <code>String</code> giving the name of the header
474761f14bca Initial load
duke
parents:
diff changeset
   490
     *                  to be added
474761f14bca Initial load
duke
parents:
diff changeset
   491
     * @param   value   a <code>String</code> giving the value of the header
474761f14bca Initial load
duke
parents:
diff changeset
   492
     *                  to be added
474761f14bca Initial load
duke
parents:
diff changeset
   493
     *
474761f14bca Initial load
duke
parents:
diff changeset
   494
     * @exception IllegalArgumentException if there was a problem with
474761f14bca Initial load
duke
parents:
diff changeset
   495
     *            the specified mime header name or value
474761f14bca Initial load
duke
parents:
diff changeset
   496
     */
474761f14bca Initial load
duke
parents:
diff changeset
   497
    public abstract void addMimeHeader(String name, String value);
474761f14bca Initial load
duke
parents:
diff changeset
   498
474761f14bca Initial load
duke
parents:
diff changeset
   499
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   500
     * Retrieves all the headers for this <code>AttachmentPart</code> object
474761f14bca Initial load
duke
parents:
diff changeset
   501
     * as an iterator over the <code>MimeHeader</code> objects.
474761f14bca Initial load
duke
parents:
diff changeset
   502
     *
474761f14bca Initial load
duke
parents:
diff changeset
   503
     * @return  an <code>Iterator</code> object with all of the Mime
474761f14bca Initial load
duke
parents:
diff changeset
   504
     *          headers for this <code>AttachmentPart</code> object
474761f14bca Initial load
duke
parents:
diff changeset
   505
     */
474761f14bca Initial load
duke
parents:
diff changeset
   506
    public abstract Iterator getAllMimeHeaders();
474761f14bca Initial load
duke
parents:
diff changeset
   507
474761f14bca Initial load
duke
parents:
diff changeset
   508
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   509
     * Retrieves all <code>MimeHeader</code> objects that match a name in
474761f14bca Initial load
duke
parents:
diff changeset
   510
     * the given array.
474761f14bca Initial load
duke
parents:
diff changeset
   511
     *
474761f14bca Initial load
duke
parents:
diff changeset
   512
     * @param names a <code>String</code> array with the name(s) of the
474761f14bca Initial load
duke
parents:
diff changeset
   513
     *        MIME headers to be returned
474761f14bca Initial load
duke
parents:
diff changeset
   514
     * @return  all of the MIME headers that match one of the names in the
474761f14bca Initial load
duke
parents:
diff changeset
   515
     *           given array as an <code>Iterator</code> object
474761f14bca Initial load
duke
parents:
diff changeset
   516
     */
474761f14bca Initial load
duke
parents:
diff changeset
   517
    public abstract Iterator getMatchingMimeHeaders(String[] names);
474761f14bca Initial load
duke
parents:
diff changeset
   518
474761f14bca Initial load
duke
parents:
diff changeset
   519
    /**
474761f14bca Initial load
duke
parents:
diff changeset
   520
     * Retrieves all <code>MimeHeader</code> objects whose name does
474761f14bca Initial load
duke
parents:
diff changeset
   521
     * not match a name in the given array.
474761f14bca Initial load
duke
parents:
diff changeset
   522
     *
474761f14bca Initial load
duke
parents:
diff changeset
   523
     * @param names a <code>String</code> array with the name(s) of the
474761f14bca Initial load
duke
parents:
diff changeset
   524
     *        MIME headers not to be returned
474761f14bca Initial load
duke
parents:
diff changeset
   525
     * @return  all of the MIME headers in this <code>AttachmentPart</code> object
474761f14bca Initial load
duke
parents:
diff changeset
   526
     *          except those that match one of the names in the
474761f14bca Initial load
duke
parents:
diff changeset
   527
     *           given array.  The nonmatching MIME headers are returned as an
474761f14bca Initial load
duke
parents:
diff changeset
   528
     *           <code>Iterator</code> object.
474761f14bca Initial load
duke
parents:
diff changeset
   529
     */
474761f14bca Initial load
duke
parents:
diff changeset
   530
    public abstract Iterator getNonMatchingMimeHeaders(String[] names);
474761f14bca Initial load
duke
parents:
diff changeset
   531
}