KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > mail > MultipartDataSource


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21
22 /*
23  * @(#)MultipartDataSource.java 1.7 05/08/29
24  *
25  * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
26  */

27
28 package javax.mail;
29
30 import java.util.Vector JavaDoc;
31 import java.io.InputStream JavaDoc;
32 import java.io.OutputStream JavaDoc;
33 import java.io.IOException JavaDoc;
34 import javax.activation.DataSource JavaDoc;
35
36 /**
37  * MultipartDataSource is a <code>DataSource</code> that contains body
38  * parts. This allows "mail aware" <code>DataContentHandlers</code> to
39  * be implemented more efficiently by being aware of such
40  * <code>DataSources</code> and using the appropriate methods to access
41  * <code>BodyParts</code>. <p>
42  *
43  * Note that the data of a MultipartDataSource is also available as
44  * an input stream. <p>
45  *
46  * This interface will typically be implemented by providers that
47  * preparse multipart bodies, for example an IMAP provider.
48  *
49  * @version 1.7, 05/08/29
50  * @author John Mani
51  * @see javax.activation.DataSource
52  */

53
54 public interface MultipartDataSource extends DataSource JavaDoc {
55
56     /**
57      * Return the number of enclosed BodyPart objects.
58      *
59      * @return number of parts
60      */

61     public int getCount();
62
63     /**
64      * Get the specified Part. Parts are numbered starting at 0.
65      *
66      * @param index the index of the desired Part
67      * @return the Part
68      * @exception IndexOutOfBoundsException if the given index
69      * is out of range.
70      * @exception MessagingException
71      */

72     public BodyPart JavaDoc getBodyPart(int index) throws MessagingException JavaDoc;
73
74 }
75
Popular Tags