com.ericsson.otp.erlang
Class OtpErlangString

java.lang.Object
  |
  +--com.ericsson.otp.erlang.OtpErlangObject
        |
        +--com.ericsson.otp.erlang.OtpErlangString

public class OtpErlangString
extends OtpErlangObject
implements java.io.Serializable, java.lang.Cloneable

Provides a Java representation of Erlang strings.

See Also:
Serialized Form

Constructor Summary
OtpErlangString(OtpInputStream buf)
          Create an Erlang string from a stream containing a string encoded in Erlang external format.
OtpErlangString(java.lang.String str)
          Create an Erlang string from the given string.
 
Method Summary
 void encode(OtpOutputStream buf)
          Convert this string to the equivalent Erlang external representation.
 boolean equals(java.lang.Object o)
          Determine if two strings are equal.
 java.lang.String stringValue()
          Get the actual string contained in this object.
 java.lang.String toString()
          Get the printable version of the string contained in this object.
 
Methods inherited from class com.ericsson.otp.erlang.OtpErlangObject
clone, decode
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OtpErlangString

public OtpErlangString(java.lang.String str)
Create an Erlang string from the given string.

OtpErlangString

public OtpErlangString(OtpInputStream buf)
                throws OtpErlangDecodeException
Create an Erlang string from a stream containing a string encoded in Erlang external format.
Parameters:
buf - the stream containing the encoded string.
Throws:
OtpErlangDecodeException - if the buffer does not contain a valid external representation of an Erlang string.
Method Detail

stringValue

public java.lang.String stringValue()
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()

toString

public java.lang.String toString()
Get the printable version of the string contained in this object.
Overrides:
toString in class OtpErlangObject
Returns:
the string contained in this object, quoted.
See Also:
stringValue()

encode

public void encode(OtpOutputStream buf)
Convert this string to the equivalent Erlang external representation.
Overrides:
encode in class OtpErlangObject
Parameters:
buf - an output stream to which the encoded string should be written.

equals

public boolean equals(java.lang.Object o)
Determine if two strings are equal. They are equal if they represent the same sequence of characters. This method can be used to compare OtpErlangStrings with each other and with Strings.
Overrides:
equals in class OtpErlangObject
Parameters:
o - the OtpErlangString or String to compare to.
Returns:
true if the strings consist of the same sequence of characters, false otherwise.