i2p.susi.webmail.encoding

## Class EightBit

- java.lang.Object
- - i2p.susi.webmail.encoding.Encoding
  - - i2p.susi.webmail.encoding.EightBit

-     public class EightBit
      extends Encoding

  Decode only. See encode().

- - ### Field Summary

    - ### Fields inherited from class i2p.susi.webmail.encoding.Encoding

      `_log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EightBit()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Buffer` | `decode(Buffer in)` Decode a buffer into another buffer.
    `Buffer` | `decode(byte[] in, int offset, int length)` Decode a portion of a byte array.
    `void` | `decode(InputStream in, Buffer out)` Copy in to out, unchanged
    `String` | `encode(byte[] in)` TODO would be nice to implement this, as it is supported on the project server, but content must be CRLF terminated with a max of 998 chars per line.
    `String` | `getName()` Returns the name of this encoding.

    - ### Methods inherited from class i2p.susi.webmail.encoding.Encoding

      `decode, decode, decode, encode, encode`

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

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

- - ### Constructor Detail

    - #### EightBit

          public EightBit()

  - ### Method Detail

    - #### decode

          public Buffer decode(Buffer in)

      Description copied from class: `Encoding`
      Decode a buffer into another buffer. This implementation just calls decode(in.content, in.offset, in.length). Most classes will not need to override.
      Overrides:
        `decode` in class `Encoding`
      Parameters:
        `in` - the buffer containing data to decode
      Returns:
        in unchanged
      See Also:
        `Encoding.decode(byte[], int, int)`

    - #### decode

          public Buffer decode(byte[] in,
                               int offset,
                               int length)

      Description copied from class: `Encoding`
      Decode a portion of a byte array.
      Overrides:
        `decode` in class `Encoding`
      Parameters:
        `in` - the byte array to decode
        `offset` - the starting position in the array
        `length` - the number of bytes to decode
      Returns:
        a buffer containing the decoded data as a String

    - #### decode

          public void decode(InputStream in,
                             Buffer out)
                      throws IOException

      Copy in to out, unchanged
      Specified by:
        `decode` in class `Encoding`
      Parameters:
        `in` - the input stream to read data from
        `out` - the buffer to write decoded data to
      Throws:
        `DecodingException` - if decoding fails
        `IOException` - if reading from input stream fails
      See Also:
        `Encoding.decode(byte[], int, int)`

    - #### encode

          public String encode(byte[] in)
                        throws EncodingException

      TODO would be nice to implement this, as it is supported on the project server, but content must be CRLF terminated with a max of 998 chars per line. And you can't have leading dots either, we'd have to prevent or double-dot it. That would be expensive to check, using either a double read or pulling it all into memory. So it's prohibitive for attachments. We could do it for the message body, since it's in memory already, but that's not much of a win. ref: https://stackoverflow.com/questions/29510178/how-to-handle-1000-character-lines-in-8bit-mime
      Specified by:
        `encode` in class `Encoding`
      Parameters:
        `in` - the byte array to encode
      Returns:
        the encoded string, SMTP-safe
      Throws:
        `EncodingException` - always

    - #### getName

          public String getName()

      Description copied from class: `Encoding`
      Returns the name of this encoding.
      Specified by:
        `getName` in class `Encoding`
      Returns:
        the encoding name