toString method

  1. @override
String toString()
override
Returns a

Implementation

@override
String toString() {
  if (this.Content == null) {
    return "";
  } else {
    try {
      // return the Base64 representation of the content.
      // Note: Encoding.GetString can throw DecoderFallbackException which is a subclass
      // of ArgumentException.
      String? charSet = StringUtils.IsNullOrEmpty(this.CharacterSet)
          ? utf8.name
          : this.CharacterSet;
      Encoding encoding = Encoding.getByName(charSet)!;
      return encoding.decode(this.Content!);
    } catch (ArgumentException) {
      return base64.encode(this.Content!);
    }
  }
}