Interface Part


  • public interface Part
    A MIME part.
    • Method Detail

      • 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
      • 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
      • getDataHandler

        DataHandler getDataHandler()
        Get the content of this part as a DataHandler.
        Returns:
        the content of this 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.