1. /*
  2. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  3. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  4. */
  5. package javax.mail;
  6. import java.util.Vector;
  7. import java.io.InputStream;
  8. import java.io.OutputStream;
  9. import java.io.IOException;
  10. import javax.activation.DataSource;
  11. /**
  12. * MultipartDataSource is a <code>DataSource</code> that contains body
  13. * parts. This allows "mail aware" <code>DataContentHandlers</code> to
  14. * be implemented more efficiently by being aware of such
  15. * <code>DataSources</code> and using the appropriate methods to access
  16. * <code>BodyParts</code>. <p>
  17. *
  18. * Note that the data of a MultipartDataSource is also available as
  19. * an input stream. <p>
  20. *
  21. * This interface will typically be implemented by providers that
  22. * preparse multipart bodies, for example an IMAP provider.
  23. *
  24. * @version 1.5, 99/12/06
  25. * @author John Mani
  26. * @see javax.activation.DataSource
  27. */
  28. public interface MultipartDataSource extends DataSource {
  29. /**
  30. * Return the number of enclosed BodyPart objects.
  31. *
  32. * @return number of parts
  33. */
  34. public int getCount();
  35. /**
  36. * Get the specified Part. Parts are numbered starting at 0.
  37. *
  38. * @param index the index of the desired Part
  39. * @return the Part
  40. * @exception IndexOutOfBoundsException if the given index
  41. * is out of range.
  42. * @exception MessagingException
  43. */
  44. public BodyPart getBodyPart(int index) throws MessagingException;
  45. }