Package com.ericsson.otp.erlang
Class OtpErlangAtom
- java.lang.Object
- 
- com.ericsson.otp.erlang.OtpErlangObject
- 
- com.ericsson.otp.erlang.OtpErlangAtom
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.lang.Cloneable
 - Direct Known Subclasses:
- OtpErlangBoolean
 
 public class OtpErlangAtom extends OtpErlangObject Provides a Java representation of Erlang atoms. Atoms can be created from strings whose length is not more thanmaxAtomLengthcharacters.- See Also:
- Serialized Form
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class com.ericsson.otp.erlang.OtpErlangObjectOtpErlangObject.Hash
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static intmaxAtomLengthThe maximum allowed length of an atom, in characters- 
Fields inherited from class com.ericsson.otp.erlang.OtpErlangObjecthashCodeValue
 
- 
 - 
Constructor SummaryConstructors Constructor Description OtpErlangAtom(boolean t)Create an atom whose value is "true" or "false".OtpErlangAtom(OtpInputStream buf)Create an atom from a stream containing an atom encoded in Erlang external format.OtpErlangAtom(java.lang.String atom)Create an atom from the given string.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringatomValue()Get the actual string contained in this object.booleanbooleanValue()The boolean value of this atom.protected intdoHashCode()voidencode(OtpOutputStream buf)Convert this atom to the equivalent Erlang external representation.booleanequals(java.lang.Object o)Determine if two atoms are equal.java.lang.StringtoString()Get the printname of the atom represented by this object.
 
- 
- 
- 
Field Detail- 
maxAtomLengthpublic static final int maxAtomLength The maximum allowed length of an atom, in characters- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
OtpErlangAtompublic OtpErlangAtom(java.lang.String atom) Create an atom from the given string.- Parameters:
- atom- the string to create the atom from.
- Throws:
- java.lang.IllegalArgumentException- if the string is null or contains more than- maxAtomLengthcharacters.
 
 - 
OtpErlangAtompublic OtpErlangAtom(OtpInputStream buf) throws OtpErlangDecodeException Create an atom from a stream containing an atom encoded in Erlang external format.- Parameters:
- buf- the stream containing the encoded atom.
- Throws:
- OtpErlangDecodeException- if the buffer does not contain a valid external representation of an Erlang atom.
 
 - 
OtpErlangAtompublic OtpErlangAtom(boolean t) Create an atom whose value is "true" or "false".
 
- 
 - 
Method Detail- 
atomValuepublic java.lang.String atomValue() Get the actual string contained in this object.- Returns:
- the raw string contained in this object, without regard to Erlang quoting rules.
- See Also:
- toString()
 
 - 
booleanValuepublic boolean booleanValue() The boolean value of this atom.- Returns:
- the value of this atom expressed as a boolean value. If the atom consists of the characters "true" (independent of case) the value will be true. For any other values, the value will be false.
 
 - 
toStringpublic java.lang.String toString() Get the printname of the atom represented by this object. The difference between this method and {link #atomValue atomValue()} is that the printname is quoted and escaped where necessary, according to the Erlang rules for atom naming.- Specified by:
- toStringin class- OtpErlangObject
- Returns:
- the printname representation of this atom object.
- See Also:
- atomValue()
 
 - 
equalspublic boolean equals(java.lang.Object o) Determine if two atoms are equal.- Specified by:
- equalsin class- OtpErlangObject
- Parameters:
- o- the other object to compare to.
- Returns:
- true if the atoms are equal, false otherwise.
 
 - 
doHashCodeprotected int doHashCode() - Overrides:
- doHashCodein class- OtpErlangObject
 
 - 
encodepublic void encode(OtpOutputStream buf) Convert this atom to the equivalent Erlang external representation.- Specified by:
- encodein class- OtpErlangObject
- Parameters:
- buf- an output stream to which the encoded atom should be written.
 
 
- 
 
-