Package org.apache.axiom.mime

# Interface Part

public interface Part
A MIME part.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `discard()`
  Discard the content of this part.
  `void`
  `fetch()`
  Make sure that this part has been fully read from the underlying stream.
  `Blob`
  `getBlob()`
  Get the content of this part as a `Blob`.
  `String`
  `getContentID()`
  Get the content ID of this part, i.e. the value of the `Content-ID` header with the enclosing brackets removed.
  `ContentType`
  `getContentType()`
  Get the content type of this part.
  `String`
  `getHeader(String name)`
  Get the value of a specific header.
  `List<Header>`
  `getHeaders()`
  Get the headers of this part.
  `InputStream`
  `getInputStream(boolean preserve)`
  Get the content of this part as an `InputStream`.
  `PartBlob`
  `getPartBlob()`
  Get the `PartBlob` instance created by the configured `PartBlobFactory`.

- ## Method Details

  - ### getHeaders

    List<Header> getHeaders()
    Get the headers of this part.
    Returns:
      the headers

  - ### getHeader

    String getHeader(String name)
    Get the value of a specific header. If there are multiple headers with the same name, only the first value is returned.
    Parameters:
      `name` - the header name
    Returns:
      the value of the header, or `null` if the part doesn't have a header with the given name

  - ### getContentType

    ContentType getContentType()
    Get the content type of this part.
    Returns:
      the parsed value of the `Content-Type` header

  - ### getContentID

    String getContentID()
    Get the content ID of this part, i.e. the value of the `Content-ID` header with the enclosing brackets removed.
    Returns:
      the content ID of the part or `null` if the part doesn't have a content ID

  - ### getBlob

    Blob getBlob()
    Get the content of this part as a `Blob`.
    Returns:
      the content of this part

  - ### getPartBlob

    PartBlob getPartBlob()
    Get the `PartBlob` instance created by the configured `PartBlobFactory`.
    Returns:
      the `PartBlob` instance

  - ### getInputStream

    InputStream getInputStream(boolean preserve)
    Get the content of this part as an `InputStream`.
    Parameters:
      `preserve` - `true` if the content should be preserved so that it can be read multiple times, `false` to discard the content when it is read
    Returns:
      the content of the part

  - ### fetch

    void fetch()
    Make sure that this part has been fully read from the underlying stream.

  - ### discard

    void discard()
    Discard the content of this part.