public class OtpErlangLong extends OtpErlangObject
OtpErlangByte, OtpErlangChar, OtpErlangInt
, and OtpErlangShort attempt to map the Erlang types onto the various
Java integral types. Two additional classes, OtpErlangUInt and
OtpErlangUShort are provided for Corba compatibility. See the
documentation for IC for more information.OtpErlangObject.HashhashCodeValue| Constructor and Description |
|---|
OtpErlangLong(java.math.BigInteger v)
Create an Erlang integer from the given value.
|
OtpErlangLong(long l)
Create an Erlang integer from the given value.
|
OtpErlangLong(OtpInputStream buf)
Create an Erlang integer from a stream containing an integer encoded in
Erlang external format.
|
| Modifier and Type | Method and Description |
|---|---|
java.math.BigInteger |
bigIntegerValue()
Get this number as a BigInteger.
|
int |
bitLength()
Returns the number of bits in the minimal two's-complement representation
of this BigInteger, excluding a sign bit.
|
byte |
byteValue()
Get this number as a byte.
|
char |
charValue()
Get this number as a char.
|
protected int |
doHashCode() |
void |
encode(OtpOutputStream buf)
Convert this number to the equivalent Erlang external representation.
|
boolean |
equals(java.lang.Object o)
Determine if two numbers are equal.
|
int |
intValue()
Get this number as an int.
|
boolean |
isLong()
Determine if this value can be represented as a long without truncation.
|
boolean |
isULong()
Determine if this value can be represented as an unsigned long without
truncation, that is if the value is non-negative and its bit pattern
completely fits in a long.
|
long |
longValue()
Get this number as a long, or rather truncate all but the least
significant 64 bits from the 2's complement representation of this number
and return them as a long.
|
short |
shortValue()
Get this number as a short.
|
int |
signum()
Return the signum function of this object.
|
java.lang.String |
toString()
Get the string representation of this number.
|
int |
uIntValue()
Get this number as a non-negative int.
|
short |
uShortValue()
Get this number as a non-negative short.
|
public OtpErlangLong(long l)
l - the long value to use.public OtpErlangLong(java.math.BigInteger v)
v - the big integer value to use.public OtpErlangLong(OtpInputStream buf) throws OtpErlangDecodeException
buf - the stream containing the encoded value.OtpErlangDecodeException - if the buffer does not contain a valid external
representation of an Erlang integer.public java.math.BigInteger bigIntegerValue()
public long longValue()
public boolean isLong()
public boolean isULong()
public int bitLength()
public int signum()
public int intValue()
throws OtpErlangRangeException
OtpErlangRangeException - if the value is too large to be represented as an int.public int uIntValue()
throws OtpErlangRangeException
OtpErlangRangeException - if the value is too large to be represented as an int, or
if the value is negative.public short shortValue()
throws OtpErlangRangeException
OtpErlangRangeException - if the value is too large to be represented as a short.public short uShortValue()
throws OtpErlangRangeException
OtpErlangRangeException - if the value is too large to be represented as a short, or
if the value is negative.public char charValue()
throws OtpErlangRangeException
OtpErlangRangeException - if the value is too large to be represented as a char.public byte byteValue()
throws OtpErlangRangeException
OtpErlangRangeException - if the value is too large to be represented as a byte.public java.lang.String toString()
toString in class OtpErlangObjectpublic void encode(OtpOutputStream buf)
encode in class OtpErlangObjectbuf - an output stream to which the encoded number should be
written.public boolean equals(java.lang.Object o)
equals in class OtpErlangObjecto - the number to compare to.protected int doHashCode()
doHashCode in class OtpErlangObject