i2p.susi.webmail

## Class MailPart

- java.lang.Object
- - i2p.susi.webmail.MailPart

-     class MailPart
      extends Object

  Represents a part of a multipart email message with headers and content.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `Buffer` | `buffer`
    `String` | `charset` encoding non-null
    `String` | `cid` encoding non-null
    `int` | `decodedLength` the decoded length if known, else -1
    `String` | `description` encoding non-null
    `String` | `disposition` encoding non-null
    `String` | `encoding` encoding non-null
    `String` | `filename` fixme never set
    `String[]` | `headerLines`
    `boolean` | `message`
    `boolean` | `multipart`
    `String` | `multipart_type` encoding non-null
    `String` | `name` encoding non-null
    `List<MailPart>` | `parts`
    `String` | `type` encoding non-null
    `String` | `uidl` the UIDL of the mail, same for all parts
    `String` | `version` encoding non-null

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MailPart(String uidl, AtomicInteger id, Buffer readBuffer, InputStream in, ReadCounter counter, String[] hdrlines)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `decode(int offset, Buffer out)` Synched because FileBuffer keeps stream open
    `int` | `getID()` A value unique across all the parts of this Mail, and constant across restarts, so it may be part of a bookmark.
    `void` | `outputRaw(OutputStream out)` Synched because FileBuffer keeps stream open Caller must close out
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### buffer

          public final Buffer buffer

    - #### charset

          public final String charset

      encoding non-null

    - #### cid

          public final String cid

      encoding non-null

    - #### decodedLength

          public int decodedLength

      the decoded length if known, else -1

    - #### description

          public final String description

      encoding non-null

    - #### disposition

          public final String disposition

      encoding non-null

    - #### encoding

          public final String encoding

      encoding non-null

    - #### filename

          public final String filename

      fixme never set

    - #### headerLines

          public final String[] headerLines

    - #### message

          public final boolean message

    - #### multipart

          public final boolean multipart

    - #### multipart_type

          public final String multipart_type

      encoding non-null

    - #### name

          public final String name

      encoding non-null

    - #### parts

          public final List<MailPart> parts

    - #### type

          public final String type

      encoding non-null

    - #### uidl

          public final String uidl

      the UIDL of the mail, same for all parts

    - #### version

          public final String version

      encoding non-null

  - ### Constructor Detail

    - #### MailPart

          public MailPart(String uidl,
                          AtomicInteger id,
                          Buffer readBuffer,
                          InputStream in,
                          ReadCounter counter,
                          String[] hdrlines)
                   throws IOException

      Parameters:
        `readBuffer` - has zero offset for top-level MailPart.
        `in` - used for reading (NOT readBuffer.getInputStream())
        `counter` - used for counting how much we have read. Probably the same as InputStream but a different interface.
        `hdrlines` - non-null for top-level MailPart, where they were already parsed in Mail. Null otherwise
      Throws:
        `IOException`

  - ### Method Detail

    - #### decode

          public void decode(int offset,
                             Buffer out)
                      throws IOException

      Synched because FileBuffer keeps stream open
      Parameters:
        `offset` - 2 for sendAttachment, 0 otherwise, probably for \r\n
      Throws:
        `IOException`

    - #### getID

          public int getID()

      A value unique across all the parts of this Mail, and constant across restarts, so it may be part of a bookmark.

    - #### outputRaw

          public void outputRaw(OutputStream out)
                         throws IOException

      Synched because FileBuffer keeps stream open Caller must close out
      Throws:
        `IOException`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`