net.rim.device.api.io
Class DatagramAddressBase

java.lang.Object
  extended by net.rim.device.api.io.DatagramAddressBase
Direct Known Subclasses:
MobitexAddress, SmsAddress

public class DatagramAddressBase
extends Object

This is the generic datagram address interface.

Since:
BlackBerry API 4.0.0

Field Summary
static int NONE
          Constant value for "no result".
protected  String _address
           
protected  int _key
           
 
Constructor Summary
DatagramAddressBase()
          Creates a new DatagramAddressBase instance.
DatagramAddressBase(String address)
          Creates a new DatagramAddressBase instance based on an existing address string.
DatagramAddressBase(DatagramAddressBase addressBase)
          Creates a new DatagramAddressBase instance based on an existing address base.
 
Method Summary
static void appendHex(byte[] buf, int offset, int value, int length)
          Appends a hex value to provided byte array.
static void appendHex(StringBuffer buf, int offset, int value, int length)
          Appends a hex value to provided string buffer.
 boolean equals(Object addressBase)
          Compares this object with provided address base.
 String getAddress()
          Retrieves this object's address.
 int getKey()
          Retrieves this object's key.
 String getSubAddress()
          Retrieves this object's sub-address.
 DatagramAddressBase getSubAddressBase()
          Retrieves this object's sub-address base.
 int hashCode()
          Retrieves hash of this object's address.
static int indexOfNextDelim(String str, int start)
          Retrieves index of next delimiter in provided string.
static int parseInt(byte[] buf, int start, int end, int radix)
          Parse out integer value contained in byte array.
static int parseInt(String buf, int start, int end, int radix)
          Parse out integer value contained in string.
static long parseLong(String buf, int start, int end, int radix)
          Parse out long integer value contained in string.
static int readInt(byte[] buf, int offset)
          Reads an integer value out of provided buffer.
static short readShort(byte[] buf, int offset)
          Reads a short integer value out of provided buffer.
 void setAddress(String address)
          Sets new address for this address base.
static void writeInt(byte[] buf, int offset, int value)
          Writes integer value into provided buffer.
static void writeShort(byte[] buf, int offset, int value)
          Writes short value into provided buffer.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

NONE

public static final int NONE
Constant value for "no result".

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

_address

protected String _address
Since:
BlackBerry API 4.0.0

_key

protected int _key
Since:
BlackBerry API 4.0.0


Constructor Detail

DatagramAddressBase

public DatagramAddressBase()
Creates a new DatagramAddressBase instance.

Since:
BlackBerry API 4.0.0

DatagramAddressBase

public DatagramAddressBase(DatagramAddressBase addressBase)
Creates a new DatagramAddressBase instance based on an existing address base.

Parameters:
addressBase - Addres base to use as template for this new object.
Since:
BlackBerry API 4.0.0

DatagramAddressBase

public DatagramAddressBase(String address)
Creates a new DatagramAddressBase instance based on an existing address string.

Parameters:
address - Address to use for this new object.
Since:
BlackBerry API 4.0.0


Method Detail

setAddress

public void setAddress(String address)
Sets new address for this address base.

Parameters:
address - New address to use for this object.
Since:
BlackBerry API 4.0.0

getAddress

public String getAddress()
Retrieves this object's address.

Returns:
Address for this address base.
Since:
BlackBerry API 4.0.0

getSubAddress

public String getSubAddress()
Retrieves this object's sub-address.

Returns:
Sub-address for this address base.
Since:
BlackBerry API 4.0.0

getSubAddressBase

public DatagramAddressBase getSubAddressBase()
Retrieves this object's sub-address base.

Returns:
Null.
Since:
BlackBerry API 4.0.0

getKey

public int getKey()
Retrieves this object's key.

Returns:
Key for this object.
Since:
BlackBerry API 4.0.0

equals

public boolean equals(Object addressBase)
Compares this object with provided address base.

Overrides:
equals in class Object
Parameters:
addressBase - Address base to compare with this one.
Returns:
True if this address base is equal to provided address base (either the same object, or identical address); otherwise, false.
See Also:
Boolean.hashCode(), Hashtable
Since:
BlackBerry API 4.0.0

hashCode

public int hashCode()
Retrieves hash of this object's address.

Overrides:
hashCode in class Object
Returns:
Hash of this object's address, or 7 if this object has a null address.
See Also:
Object.equals(java.lang.Object), Hashtable
Since:
BlackBerry API 4.0.0

indexOfNextDelim

public static int indexOfNextDelim(String str,
                                   int start)
Retrieves index of next delimiter in provided string.

Parameters:
str - String to parse through.
start - First character in string to examine.
Returns:
Index of first delimiter character in string after the start position (may be your start position if a delimiter is found there).
Since:
BlackBerry API 4.0.0

readShort

public static short readShort(byte[] buf,
                              int offset)
Reads a short integer value out of provided buffer.

Parameters:
buf - Byte array buffer from which to peel short.
offset - First byte in array to use.
Returns:
Short integer value peeled out of provided buffer.
Since:
BlackBerry API 4.0.0

readInt

public static int readInt(byte[] buf,
                          int offset)
Reads an integer value out of provided buffer.

Parameters:
buf - Byte array buffer from which to peel integer.
offset - First byte in array to use.
Returns:
Integer value peeled out of provided buffer.
Since:
BlackBerry API 4.0.0

writeInt

public static void writeInt(byte[] buf,
                            int offset,
                            int value)
Writes integer value into provided buffer.

Parameters:
buf - Byte array to receive integer.
offset - Byte position in array at which to write value.
value - Integer value to write.
Since:
BlackBerry API 4.0.0

writeShort

public static void writeShort(byte[] buf,
                              int offset,
                              int value)
Writes short value into provided buffer.

Parameters:
buf - Byte array to receive integer.
offset - Byte position in array at which to write value.
value - Integer value to write.
Since:
BlackBerry API 4.2.0

parseInt

public static int parseInt(String buf,
                           int start,
                           int end,
                           int radix)
Parse out integer value contained in string.

Parameters:
buf - String to examine.
start - First character in string buffer to consider.
end - Last character in string buffer to consider.
radix - Radix to use.
Returns:
Integer value retrieved from string buffer.
Throws:
IllegalArugmentException - If portion of string buffer examined contains a non-digit character.
Since:
BlackBerry API 4.0.0

parseInt

public static int parseInt(byte[] buf,
                           int start,
                           int end,
                           int radix)
Parse out integer value contained in byte array.

Parameters:
buf - Byte array to examine.
start - First byte in buffer to consider.
end - Last byte in buffer to consider.
radix - Radix to use.
Returns:
Integer value retrieved from byte array.
Since:
BlackBerry API 4.0.0

parseLong

public static long parseLong(String buf,
                             int start,
                             int end,
                             int radix)
Parse out long integer value contained in string.

Parameters:
buf - String to examine.
start - First character in string buffer to consider.
end - Last character in string buffer to consider.
radix - Radix to use.
Returns:
Long integer value retrieved from string buffer.
Throws:
IllegalArugmentException - If portion of string buffer examined contains a non-digit character.
Since:
BlackBerry API 4.0.0

appendHex

public static void appendHex(StringBuffer buf,
                             int offset,
                             int value,
                             int length)
Appends a hex value to provided string buffer.

Parameters:
buff - String buffer to receive appended value.
offset - Point in buffer at which to append value.
value - Value to append to buffer.
length - Maximum length to add to buffer.
Since:
BlackBerry API 4.0.0

appendHex

public static void appendHex(byte[] buf,
                             int offset,
                             int value,
                             int length)
Appends a hex value to provided byte array.

Parameters:
buf - Byte array to receive appended value.
offset - Point in buffer at which to append value.
value - Value to append to buffer.
length - Maximum length to add to buffer.
Since:
BlackBerry API 4.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.