getContentTransferEncodingName static method

String getContentTransferEncodingName(
  1. TransferEncoding encoding
)

Retrieves the name of the specified encoding.

Throws an InvalidArgumentException when the encoding is not yet handled.

Implementation

static String getContentTransferEncodingName(TransferEncoding encoding) {
  switch (encoding) {
    case TransferEncoding.sevenBit:
      return '7bit';
    case TransferEncoding.eightBit:
      return '8bit';
    case TransferEncoding.quotedPrintable:
      return 'quoted-printable';
    case TransferEncoding.base64:
      return 'base64';
    default:
      throw InvalidArgumentException(
        'Unhandled transfer encoding: $encoding',
      );
  }
}