Added in API level 1

Rfc822Token


open class Rfc822Token
kotlin.Any
   ↳ android.text.util.Rfc822Token

This class stores an RFC 822-like name, address, and comment, and provides methods to convert them to quoted strings.

Summary

Public constructors
Rfc822Token(name: String?, address: String?, comment: String?)

Creates a new Rfc822Token with the specified name, address, and comment.

Public methods
open Boolean
equals(other: Any?)

Indicates whether some other object is "equal to" this one.

open String?

Returns the address part.

open String?

Returns the comment part.

open String?

Returns the name part.

open Int

open static String!
quoteComment(comment: String!)

Returns the comment, with internal backslashes and parentheses preceded by backslashes.

open static String!
quoteName(name: String!)

Returns the name, with internal backslashes and quotation marks preceded by backslashes.

open static String!

Returns the name, conservatively quoting it if there are any characters that are likely to cause trouble outside of a quoted string, or returning it literally if it seems safe.

open Unit
setAddress(address: String?)

Changes the address to the specified address.

open Unit
setComment(comment: String?)

Changes the comment to the specified comment.

open Unit
setName(name: String?)

Changes the name to the specified name.

open String

Returns the name (with quoting added if necessary), the comment (in parentheses), and the address (in angle brackets).

Public constructors

Rfc822Token

Added in API level 1
Rfc822Token(
    name: String?,
    address: String?,
    comment: String?)

Creates a new Rfc822Token with the specified name, address, and comment.

Parameters
name String?: This value may be null.
address String?: This value may be null.
comment String?: This value may be null.

Public methods

equals

Added in API level 1
open fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj the reference object with which to compare.
o This value may be null.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getAddress

Added in API level 1
open fun getAddress(): String?

Returns the address part.

Return
String? This value may be null.

getComment

Added in API level 1
open fun getComment(): String?

Returns the comment part.

Return
String? This value may be null.

getName

Added in API level 1
open fun getName(): String?

Returns the name part.

Return
String? This value may be null.

hashCode

Added in API level 1
open fun hashCode(): Int
Return
Int a hash code value for this object.

quoteComment

Added in API level 1
open static fun quoteComment(comment: String!): String!

Returns the comment, with internal backslashes and parentheses preceded by backslashes. The outer parentheses themselves are not added by this method.

quoteName

Added in API level 1
open static fun quoteName(name: String!): String!

Returns the name, with internal backslashes and quotation marks preceded by backslashes. The outer quote marks themselves are not added by this method.

quoteNameIfNecessary

Added in API level 1
open static fun quoteNameIfNecessary(name: String!): String!

Returns the name, conservatively quoting it if there are any characters that are likely to cause trouble outside of a quoted string, or returning it literally if it seems safe.

setAddress

Added in API level 1
open fun setAddress(address: String?): Unit

Changes the address to the specified address.

Parameters
address String?: This value may be null.

setComment

Added in API level 1
open fun setComment(comment: String?): Unit

Changes the comment to the specified comment.

Parameters
comment String?: This value may be null.

setName

Added in API level 1
open fun setName(name: String?): Unit

Changes the name to the specified name.

Parameters
name String?: This value may be null.

toString

Added in API level 1
open fun toString(): String

Returns the name (with quoting added if necessary), the comment (in parentheses), and the address (in angle brackets). This should be suitable for inclusion in an RFC 822 address list.

Return
String a string representation of the object.