Public Member Functions |
| Byte (unsigned char value) |
| Byte (const std::string &value) |
| Creates a new Byte instance from the given string.
|
virtual | ~Byte () |
virtual int | compareTo (const Byte &c) const |
| Compares this Byte instance with another.
|
virtual bool | operator== (const Byte &c) const |
| Compares equality between this object and the one passed.
|
virtual bool | operator< (const Byte &c) const |
| Compares this object to another and returns true if this object is considered to be less than the one passed.
|
virtual int | compareTo (const unsigned char &c) const |
| Compares this Byte instance with a char type.
|
virtual bool | operator== (const unsigned char &c) const |
| Compares equality between this object and the one passed.
|
virtual bool | operator< (const unsigned char &c) const |
| Compares this object to another and returns true if this object is considered to be less than the one passed.
|
bool | equals (const Byte &c) const |
bool | equals (const unsigned char &c) const |
std::string | toString () const |
virtual double | doubleValue () const |
| Answers the double value which the receiver represents.
|
virtual float | floatValue () const |
| Answers the float value which the receiver represents.
|
virtual unsigned char | byteValue () const |
| Answers the byte value which the receiver represents.
|
virtual short | shortValue () const |
| Answers the short value which the receiver represents.
|
virtual int | intValue () const |
| Answers the int value which the receiver represents.
|
virtual long long | longValue () const |
| Answers the long value which the receiver represents.
|
Static Public Member Functions |
static std::string | toString (unsigned char value) |
static Byte | decode (const std::string &value) |
| Decodes a String into a Byte.
|
static unsigned char | parseByte (const std::string &s, int radix) |
| Parses the string argument as a signed unsigned char in the radix specified by the second argument.
|
static unsigned char | parseByte (const std::string &s) |
| Parses the string argument as a signed decimal unsigned char.
|
static Byte | valueOf (unsigned char value) |
| Returns a Character instance representing the specified char value.
|
static Byte | valueOf (const std::string &value) |
| Returns a Byte object holding the value given by the specified std::string.
|
static Byte | valueOf (const std::string &value, int radix) |
| Returns a Byte object holding the value extracted from the specified std::string when parsed with the radix given by the second argument.
|
Static Public Attributes |
static const unsigned char | MIN_VALUE = 0x7F |
| The minimum value that a unsigned char can take on.
|
static const unsigned char | MAX_VALUE = 0x80 |
| The maximum value that a unsigned char can take on.
|
static const int | SIZE = 8 |
| The size of the primitive charactor in bits.
|
static Byte decaf::lang::Byte::decode |
( |
const std::string & |
value | ) |
[static] |
Decodes a String into a Byte.
Accepts decimal, hexadecimal, and octal numbers given by the following grammar:
The sequence of characters following an (optional) negative sign and/or radix specifier ("0x", "0X", "#", or leading zero) is parsed as by the Byte::parseByte method with the indicated radix (10, 16, or 8). This sequence of characters must represent a positive value or a NumberFormatException will be thrown. The result is negated if first character of the specified String is the minus sign. No whitespace characters are permitted in the string.
- Parameters:
-
value | - The string to decode |
- Returns:
- a Byte object containing the decoded value
- Exceptions:
-
NumberFomatException | if the string is not formatted correctly. |
static unsigned char decaf::lang::Byte::parseByte |
( |
const std::string & |
s | ) |
[static] |
Parses the string argument as a signed decimal unsigned char.
The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' to indicate a negative value. The resulting unsigned char value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseByte( const std::string, int ) method.
- Parameters:
-
s | - String to convert to a unsigned char |
- Returns:
- the converted unsigned char value
- Exceptions:
-
NumberFormatException | if the string is not a unsigned char. |
static unsigned char decaf::lang::Byte::parseByte |
( |
const std::string & |
s, |
|
|
int |
radix |
|
) |
| [static] |
Parses the string argument as a signed unsigned char in the radix specified by the second argument.
The characters in the string must all be digits, of the specified radix (as determined by whether Character.digit(char, int) returns a nonnegative value) except that the first character may be an ASCII minus sign '-' to indicate a negative value. The resulting byte value is returned.
An exception of type NumberFormatException is thrown if any of the following situations occurs: * The first argument is null or is a string of length zero. * The radix is either smaller than Character.MIN_RADIX or larger than Character::MAX_RADIX. * Any character of the string is not a digit of the specified radix, except that the first character may be a minus sign '-' provided that the string is longer than length 1. * The value represented by the string is not a value of type unsigned char.
- Parameters:
-
s | - the String containing the unsigned char to be parsed |
radix | - the radix to be used while parsing s |
- Returns:
- the unsigned char represented by the string argument in the specified radix.
- Exceptions:
-
NumberFormatException | - If String does not contain a parsable unsigned char. |