| java.lang.Object org.apache.harmony.jndi.provider.dns.ProviderMgr
ProviderMgr | public class ProviderMgr (Code) | | Contains some useful routines that are used in other classes.
|
Method Summary | |
public static boolean | checkBit(int value, int mask) Checks if any of specified bits is set. | public static String | getIpStr(byte[] ip) Creates the text representation of IPv4 address. | public static int | getMatchingCount(String name1, String name2) Compares two labels and returns the matching count (number of the
matching labels down from the root). | public static String | getParentName(String name) Returns the name of parent DNS zone for given zone. | public static int | getRecordClassNumber(String str) | public static int | getRecordTypeNumber(String str) | public static boolean | namesAreEqual(String name1, String name2) Compares two DNS names. | public static String | normalizeName(String zone) Converts all letters to lower case and adds "." to the end of zone name
if necessary. | public static int | parse16Int(byte[] buffer, int idx) Parses 16 bit integer. | public static long | parse32Int(byte[] buffer, int idx) Parses 32 bit integer. | public static int | parse8Int(byte[] buffer, int idx) Parses 8 bit integer. | public static int | parseCharString(byte[] mesBytes, int startIdx, StringBuffer result) Parses the string of characters preceded with length octet. | public static byte[] | parseIpStr(String ipStr) Parses the text representation of IPv4 address.
Parameters: ipStr - string in n.n.n.n format. | public static int | parseName(byte[] mesBytes, int startIdx, StringBuffer result) Parses the domain name from the sequence of bytes. | public static int | setBit(int value, int mask, boolean bit) Sets or drops specific bit(s) of the given number. | public static int | write16Int(int value, byte[] buffer, int startIdx) | public static int | write32Int(long value, byte[] buffer, int startIdx) | public static int | writeCharString(String value, byte[] buffer, int startIdx) Writes character string preceded with length octet. | public static int | writeName(String name, byte[] buffer, int startIdx) Parses the given domain name and converts it into
length label length label ... |
CHECK_NAMES | final static boolean CHECK_NAMES(Code) | | |
LOG_DEBUG | final static int LOG_DEBUG(Code) | | |
LOG_ERROR | final static int LOG_ERROR(Code) | | |
LOG_NONE | final static int LOG_NONE(Code) | | |
LOG_WARNING | final static int LOG_WARNING(Code) | | |
checkBit | public static boolean checkBit(int value, int mask)(Code) | | Checks if any of specified bits is set.
Parameters: value - the number to look at Parameters: mask - a bit mask true of false |
getIpStr | public static String getIpStr(byte[] ip)(Code) | | Creates the text representation of IPv4 address.
Parameters: ip - the first four bytes should contain an IPv4 address string in n.n.n.n format throws: java.lang.IllegalArgumentException - if given array has the length less than four |
getMatchingCount | public static int getMatchingCount(String name1, String name2)(Code) | | Compares two labels and returns the matching count (number of the
matching labels down from the root).
Parameters: name1 - first name Parameters: name2 - second name number of equal labels from the root to leaves |
getParentName | public static String getParentName(String name)(Code) | | Returns the name of parent DNS zone for given zone.
Parameters: name - the current DNS zone name the name of the parent |
getRecordClassNumber | public static int getRecordClassNumber(String str)(Code) | | Parameters: str - string name of the DNS record class integer number for the class; -1 if not found |
getRecordTypeNumber | public static int getRecordTypeNumber(String str)(Code) | | Parameters: str - string name of the DNS record type integer number for the type; -1 if not found |
namesAreEqual | public static boolean namesAreEqual(String name1, String name2)(Code) | | Compares two DNS names.
- Case insensitive
- Appends "." to the end of the name if necessary before comparison
Parameters: name1 - name1 Parameters: name2 - name2 true if names are equal; false otherwise |
normalizeName | public static String normalizeName(String zone)(Code) | | Converts all letters to lower case and adds "." to the end of zone name
if necessary.
Parameters: zone - zone name expanded zone name |
parse16Int | public static int parse16Int(byte[] buffer, int idx)(Code) | | Parses 16 bit integer. Buffer index should be updated manually after call
to this method.
Parameters: buffer - sequence of bytes Parameters: startIdx - the index to start at parsed integer value |
parse32Int | public static long parse32Int(byte[] buffer, int idx)(Code) | | Parses 32 bit integer. Buffer index should be updated manually after call
to this method.
Parameters: buffer - sequence of bytes Parameters: startIdx - the index to start at parsed integer value |
parse8Int | public static int parse8Int(byte[] buffer, int idx)(Code) | | Parses 8 bit integer. Buffer index should be updated manually after call
to this method.
Parameters: buffer - sequence of bytes Parameters: startIdx - the index to start at parsed integer value |
parseCharString | public static int parseCharString(byte[] mesBytes, int startIdx, StringBuffer result)(Code) | | Parses the string of characters preceded with length octet.
Parameters: mesBytes - message bytes Parameters: startIdx - the index to start parsing from Parameters: result - string buffer to write the result too updated index |
parseName | public static int parseName(byte[] mesBytes, int startIdx, StringBuffer result) throws DomainProtocolException(Code) | | Parses the domain name from the sequence of bytes.
Parameters: mesBytes - byte representation of the message Parameters: startIdx - the position to start the parsing at Parameters: result - the string buffer to store parsed strings into updated index of mesBytes array throws: DomainProtocolException - if something went wrong |
setBit | public static int setBit(int value, int mask, boolean bit)(Code) | | Sets or drops specific bit(s) of the given number.
Parameters: value - target integer value Parameters: mask - specifies bit(s) position(s) Parameters: bit - set if true , drop if false updated value |
write16Int | public static int write16Int(int value, byte[] buffer, int startIdx)(Code) | | Writes a 16-bit integer value into the buffer, high byte first
Parameters: value - the value to write, first 16 bits will be taken Parameters: buffer - the buffer to write into Parameters: startIdx - a starting index updated index |
write32Int | public static int write32Int(long value, byte[] buffer, int startIdx)(Code) | | Writes a 32-bit integer value into the buffer, highest byte first
Parameters: value - the value to write, first 32 bits will be taken Parameters: buffer - the buffer to write into Parameters: startIdx - a starting index updated index |
writeCharString | public static int writeCharString(String value, byte[] buffer, int startIdx) throws DomainProtocolException(Code) | | Writes character string preceded with length octet.
Parameters: value - string value to write Parameters: buffer - buffer to write to Parameters: startIdx - index in buffer to start from updated index throws: NullPointerException - if some argument is null throws: DomainProtocolException - if string is too long |
writeName | public static int writeName(String name, byte[] buffer, int startIdx) throws DomainProtocolException(Code) | | Parses the given domain name and converts it into
length label length label ... length label sequence of
bytes.
Parameters: name - a domain name, a dot-separated list of labels Parameters: buffer - target buffer in which the result will be written Parameters: startIdx - the index to start at while writing to the buffer array updated index of the buffer array |
|
|