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 |
Indicates whether some other object is "equal to" this one. |
open String? |
Returns the address part. |
open String? |
Returns the comment part. |
open String? |
getName() Returns the name part. |
open Int |
hashCode() |
open static String! |
quoteComment(comment: String!) Returns the comment, with internal backslashes and parentheses preceded by backslashes. |
open static String! |
Returns the name, with internal backslashes and quotation marks preceded by backslashes. |
open static String! |
quoteNameIfNecessary(name: 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 |
Changes the name to the specified name. |
open String |
toString() Returns the name (with quoting added if necessary), the comment (in parentheses), and the address (in angle brackets). |
Public constructors
Rfc822Token
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
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 returntrue
. - It is symmetric: for any non-null reference values
x
andy
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any non-null reference values
x
,y
, andz
, ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
. - It is consistent: for any non-null reference values
x
andy
, multiple invocations ofx.equals(y)
consistently returntrue
or consistently returnfalse
, provided no information used inequals
comparisons on the objects is modified. - For any non-null reference value
x
,x.equals(null)
should returnfalse
.
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
open fun getAddress(): String?
Returns the address part.
Return | |
---|---|
String? |
This value may be null . |
getComment
open fun getComment(): String?
Returns the comment part.
Return | |
---|---|
String? |
This value may be null . |
getName
open fun getName(): String?
Returns the name part.
Return | |
---|---|
String? |
This value may be null . |
hashCode
open fun hashCode(): Int
Return | |
---|---|
Int |
a hash code value for this object. |
quoteComment
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
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
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
open fun setAddress(address: String?): Unit
Changes the address to the specified address.
Parameters | |
---|---|
address |
String?: This value may be null . |
setComment
open fun setComment(comment: String?): Unit
Changes the comment to the specified comment.
Parameters | |
---|---|
comment |
String?: This value may be null . |
setName
open fun setName(name: String?): Unit
Changes the name to the specified name.
Parameters | |
---|---|
name |
String?: This value may be null . |
toString
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. |