idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
41,900
public RRset findExactMatch ( Name name , int type ) { Object types = exactName ( name ) ; if ( types == null ) return null ; return oneRRset ( types , type ) ; }
Looks up Records in the zone finding exact matches only .
44
11
41,901
public void addRRset ( RRset rrset ) { Name name = rrset . getName ( ) ; addRRset ( name , rrset ) ; }
Adds an RRset to the Zone
37
7
41,902
public void addRecord ( Record r ) { Name name = r . getName ( ) ; int rtype = r . getRRsetType ( ) ; synchronized ( this ) { RRset rrset = findRRset ( name , rtype ) ; if ( rrset == null ) { rrset = new RRset ( r ) ; addRRset ( name , rrset ) ; } else { rrset . addRR ( r ) ; } } }
Adds a Record to the Zone
100
6
41,903
public void removeRecord ( Record r ) { Name name = r . getName ( ) ; int rtype = r . getRRsetType ( ) ; synchronized ( this ) { RRset rrset = findRRset ( name , rtype ) ; if ( rrset == null ) return ; if ( rrset . size ( ) == 1 && rrset . first ( ) . equals ( r ) ) removeRRset ( name , rtype ) ; else rrset . deleteRR ...
Removes a record from the Zone
111
7
41,904
public synchronized String toMasterFile ( ) { Iterator zentries = data . entrySet ( ) . iterator ( ) ; StringBuffer sb = new StringBuffer ( ) ; nodeToString ( sb , originNode ) ; while ( zentries . hasNext ( ) ) { Map . Entry entry = ( Map . Entry ) zentries . next ( ) ; if ( ! origin . equals ( entry . getKey ( ) ) ) ...
Returns the contents of the Zone in master file format .
119
11
41,905
public static String formatString ( byte [ ] b , int lineLength , String prefix , boolean addClose ) { String s = toString ( b ) ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < s . length ( ) ; i += lineLength ) { sb . append ( prefix ) ; if ( i + lineLength >= s . length ( ) ) { sb . append ( s . subs...
Formats data into a nicely formatted base64 encoded String
159
11
41,906
public static byte [ ] fromString ( String str ) { ByteArrayOutputStream bs = new ByteArrayOutputStream ( ) ; byte [ ] raw = str . getBytes ( ) ; for ( int i = 0 ; i < raw . length ; i ++ ) { if ( ! Character . isWhitespace ( ( char ) raw [ i ] ) ) bs . write ( raw [ i ] ) ; } byte [ ] in = bs . toByteArray ( ) ; if ( ...
Convert a base64 - encoded String to binary data
498
11
41,907
public static long parse ( String s , boolean clamp ) { if ( s == null || s . length ( ) == 0 || ! Character . isDigit ( s . charAt ( 0 ) ) ) throw new NumberFormatException ( ) ; long value = 0 ; long ttl = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; long oldvalue = value ; if ( Cha...
Parses a TTL - like value which can either be expressed as a number or a BIND - style string with numbers and units .
296
28
41,908
public static Message newQuery ( Record r ) { Message m = new Message ( ) ; m . header . setOpcode ( Opcode . QUERY ) ; m . header . setFlag ( Flags . RD ) ; m . addRecord ( r , Section . QUESTION ) ; return m ; }
Creates a new Message with a random Message ID suitable for sending as a query .
62
17
41,909
public void addRecord ( Record r , int section ) { if ( sections [ section ] == null ) sections [ section ] = new LinkedList ( ) ; header . incCount ( section ) ; sections [ section ] . add ( r ) ; }
Adds a record to a section of the Message and adjusts the header .
52
14
41,910
public boolean removeRecord ( Record r , int section ) { if ( sections [ section ] != null && sections [ section ] . remove ( r ) ) { header . decCount ( section ) ; return true ; } else return false ; }
Removes a record from a section of the Message and adjusts the header .
49
15
41,911
public boolean findRecord ( Record r , int section ) { return ( sections [ section ] != null && sections [ section ] . contains ( r ) ) ; }
Determines if the given record is already present in the given section .
33
15
41,912
public boolean findRecord ( Record r ) { for ( int i = Section . ANSWER ; i <= Section . ADDITIONAL ; i ++ ) if ( sections [ i ] != null && sections [ i ] . contains ( r ) ) return true ; return false ; }
Determines if the given record is already present in any section .
57
14
41,913
public boolean findRRset ( Name name , int type , int section ) { if ( sections [ section ] == null ) return false ; for ( int i = 0 ; i < sections [ section ] . size ( ) ; i ++ ) { Record r = ( Record ) sections [ section ] . get ( i ) ; if ( r . getType ( ) == type && name . equals ( r . getName ( ) ) ) return true ;...
Determines if an RRset with the given name and type is already present in the given section .
97
21
41,914
public boolean findRRset ( Name name , int type ) { return ( findRRset ( name , type , Section . ANSWER ) || findRRset ( name , type , Section . AUTHORITY ) || findRRset ( name , type , Section . ADDITIONAL ) ) ; }
Determines if an RRset with the given name and type is already present in any section .
61
20
41,915
public Record getQuestion ( ) { List l = sections [ Section . QUESTION ] ; if ( l == null || l . size ( ) == 0 ) return null ; return ( Record ) l . get ( 0 ) ; }
Returns the first record in the QUESTION section .
47
10
41,916
public TSIGRecord getTSIG ( ) { int count = header . getCount ( Section . ADDITIONAL ) ; if ( count == 0 ) return null ; List l = sections [ Section . ADDITIONAL ] ; Record rec = ( Record ) l . get ( count - 1 ) ; if ( rec . type != Type . TSIG ) return null ; return ( TSIGRecord ) rec ; }
Returns the TSIG record from the ADDITIONAL section if one is present .
84
16
41,917
public OPTRecord getOPT ( ) { Record [ ] additional = getSectionArray ( Section . ADDITIONAL ) ; for ( int i = 0 ; i < additional . length ; i ++ ) if ( additional [ i ] instanceof OPTRecord ) return ( OPTRecord ) additional [ i ] ; return null ; }
Returns the OPT record from the ADDITIONAL section if one is present .
72
15
41,918
public Record [ ] getSectionArray ( int section ) { if ( sections [ section ] == null ) return emptyRecordArray ; List l = sections [ section ] ; return ( Record [ ] ) l . toArray ( new Record [ l . size ( ) ] ) ; }
Returns an array containing all records in the given section or an empty array if the section is empty .
57
20
41,919
public RRset [ ] getSectionRRsets ( int section ) { if ( sections [ section ] == null ) return emptyRRsetArray ; List sets = new LinkedList ( ) ; Record [ ] recs = getSectionArray ( section ) ; Set hash = new HashSet ( ) ; for ( int i = 0 ; i < recs . length ; i ++ ) { Name name = recs [ i ] . getName ( ) ; boolean new...
Returns an array containing all records in the given section grouped into RRsets .
284
15
41,920
public byte [ ] toWire ( ) { DNSOutput out = new DNSOutput ( ) ; toWire ( out ) ; size = out . current ( ) ; return out . toByteArray ( ) ; }
Returns an array containing the wire format representation of the Message .
43
12
41,921
public void setTSIG ( TSIG key , int error , TSIGRecord querytsig ) { this . tsigkey = key ; this . tsigerror = error ; this . querytsig = querytsig ; }
Sets the TSIG key and other necessary information to sign a message .
48
15
41,922
public String sectionToString ( int i ) { if ( i > 3 ) return null ; StringBuffer sb = new StringBuffer ( ) ; Record [ ] records = getSectionArray ( i ) ; for ( int j = 0 ; j < records . length ; j ++ ) { Record rec = records [ j ] ; if ( i == Section . QUESTION ) { sb . append ( ";;\t" + rec . name ) ; sb . append ( "...
Converts the given section of the Message to a String .
166
12
41,923
String rrToString ( ) { StringBuffer sb = new StringBuffer ( ) ; Iterator it = strings . iterator ( ) ; while ( it . hasNext ( ) ) { byte [ ] array = ( byte [ ] ) it . next ( ) ; sb . append ( byteArrayToString ( array , true ) ) ; if ( it . hasNext ( ) ) sb . append ( " " ) ; } return sb . toString ( ) ; }
converts to a String
100
5
41,924
public boolean isCurrent ( ) { BasicHandler handler = getBasicHandler ( ) ; return ( handler . axfr == null && handler . ixfr == null ) ; }
Returns true if the response indicates that the zone is up to date . This will be true only if an IXFR was performed .
36
26
41,925
public void apply ( Message m , int error , TSIGRecord old ) { Record r = generate ( m , m . toWire ( ) , error , old ) ; m . addRecord ( r , Section . ADDITIONAL ) ; m . tsigState = Message . TSIG_SIGNED ; }
Generates a TSIG record with a specific error for a message and adds it to the message .
64
20
41,926
public static Integer toInteger ( int val ) { if ( val >= 0 && val < cachedInts . length ) return ( cachedInts [ val ] ) ; return new Integer ( val ) ; }
Converts an int into a possibly cached Integer .
42
10
41,927
public void add ( int val , String str ) { check ( val ) ; Integer value = toInteger ( val ) ; str = sanitize ( str ) ; strings . put ( str , value ) ; values . put ( value , str ) ; }
Defines the text representation of a numeric value .
53
10
41,928
public void addAll ( Mnemonic source ) { if ( wordcase != source . wordcase ) throw new IllegalArgumentException ( source . description + ": wordcases do not match" ) ; strings . putAll ( source . strings ) ; values . putAll ( source . values ) ; }
Copies all mnemonics from one table into another .
62
13
41,929
public String getText ( int val ) { check ( val ) ; String str = ( String ) values . get ( toInteger ( val ) ) ; if ( str != null ) return str ; str = Integer . toString ( val ) ; if ( prefix != null ) return prefix + str ; return str ; }
Gets the text mnemonic corresponding to a numeric value .
65
13
41,930
public int getValue ( String str ) { str = sanitize ( str ) ; Integer value = ( Integer ) strings . get ( str ) ; if ( value != null ) { return value . intValue ( ) ; } if ( prefix != null ) { if ( str . startsWith ( prefix ) ) { int val = parseNumeric ( str . substring ( prefix . length ( ) ) ) ; if ( val >= 0 ) { ret...
Gets the numeric value corresponding to a text mnemonic .
118
13
41,931
String rrToString ( ) { StringBuffer sb = new StringBuffer ( ) ; sb . append ( preference ) ; sb . append ( " " ) ; sb . append ( map822 ) ; sb . append ( " " ) ; sb . append ( mapX400 ) ; return sb . toString ( ) ; }
Converts the PX Record to a String
75
9
41,932
public PublicKey getPublicKey ( ) throws DNSSEC . DNSSECException { if ( publicKey != null ) return publicKey ; publicKey = DNSSEC . toPublicKey ( this ) ; return publicKey ; }
Returns a PublicKey corresponding to the data in this key .
48
12
41,933
public synchronized void addRecord ( Record r , int cred , Object o ) { Name name = r . getName ( ) ; int type = r . getRRsetType ( ) ; if ( ! Type . isRR ( type ) ) return ; Element element = findElement ( name , type , cred ) ; if ( element == null ) { CacheRRset crrset = new CacheRRset ( r , cred , maxcache ) ; addR...
Adds a record to the Cache .
156
7
41,934
public synchronized void addRRset ( RRset rrset , int cred ) { long ttl = rrset . getTTL ( ) ; Name name = rrset . getName ( ) ; int type = rrset . getType ( ) ; Element element = findElement ( name , type , 0 ) ; if ( ttl == 0 ) { if ( element != null && element . compareCredibility ( cred ) <= 0 ) removeElement ( nam...
Adds an RRset to the Cache .
198
8
41,935
public synchronized void addNegative ( Name name , int type , SOARecord soa , int cred ) { long ttl = 0 ; if ( soa != null ) ttl = soa . getTTL ( ) ; Element element = findElement ( name , type , 0 ) ; if ( ttl == 0 ) { if ( element != null && element . compareCredibility ( cred ) <= 0 ) removeElement ( name , type ) ;...
Adds a negative entry to the Cache .
153
8
41,936
protected synchronized SetResponse lookup ( Name name , int type , int minCred ) { int labels ; int tlabels ; Element element ; Name tname ; Object types ; SetResponse sr ; labels = name . labels ( ) ; for ( tlabels = labels ; tlabels >= 1 ; tlabels -- ) { boolean isRoot = ( tlabels == 1 ) ; boolean isExact = ( tlabels...
Finds all matching sets or something that causes the lookup to stop .
696
14
41,937
public SetResponse lookupRecords ( Name name , int type , int minCred ) { return lookup ( name , type , minCred ) ; }
Looks up Records in the Cache . This follows CNAMEs and handles negatively cached data .
32
18
41,938
public String getString ( ) throws IOException { Token next = get ( ) ; if ( ! next . isString ( ) ) { throw exception ( "expected a string" ) ; } return next . value ; }
Gets the next token from a tokenizer and converts it to a string .
45
16
41,939
public long getLong ( ) throws IOException { String next = _getIdentifier ( "an integer" ) ; if ( ! Character . isDigit ( next . charAt ( 0 ) ) ) throw exception ( "expected an integer" ) ; try { return Long . parseLong ( next ) ; } catch ( NumberFormatException e ) { throw exception ( "expected an integer" ) ; } }
Gets the next token from a tokenizer and converts it to a long .
84
16
41,940
public long getTTL ( ) throws IOException { String next = _getIdentifier ( "a TTL value" ) ; try { return TTL . parseTTL ( next ) ; } catch ( NumberFormatException e ) { throw exception ( "expected a TTL value" ) ; } }
Gets the next token from a tokenizer and parses it as a TTL .
60
17
41,941
public long getTTLLike ( ) throws IOException { String next = _getIdentifier ( "a TTL-like value" ) ; try { return TTL . parse ( next , false ) ; } catch ( NumberFormatException e ) { throw exception ( "expected a TTL-like value" ) ; } }
Gets the next token from a tokenizer and parses it as if it were a TTL .
65
20
41,942
public Name getName ( Name origin ) throws IOException { String next = _getIdentifier ( "a name" ) ; try { Name name = Name . fromString ( next , origin ) ; if ( ! name . isAbsolute ( ) ) throw new RelativeNameException ( name ) ; return name ; } catch ( TextParseException e ) { throw exception ( e . getMessage ( ) ) ;...
Gets the next token from a tokenizer and converts it to a name .
87
16
41,943
public byte [ ] getAddressBytes ( int family ) throws IOException { String next = _getIdentifier ( "an address" ) ; byte [ ] bytes = Address . toByteArray ( next , family ) ; if ( bytes == null ) throw exception ( "Invalid address: " + next ) ; return bytes ; }
Gets the next token from a tokenizer and converts it to a byte array containing an IP address .
67
21
41,944
public InetAddress getAddress ( int family ) throws IOException { String next = _getIdentifier ( "an address" ) ; try { return Address . getByAddress ( next , family ) ; } catch ( UnknownHostException e ) { throw exception ( e . getMessage ( ) ) ; } }
Gets the next token from a tokenizer and converts it to an IP Address .
64
17
41,945
public void getEOL ( ) throws IOException { Token next = get ( ) ; if ( next . type != EOL && next . type != EOF ) { throw exception ( "expected EOL or EOF" ) ; } }
Gets the next token from a tokenizer which must be an EOL or EOF .
50
19
41,946
private String remainingStrings ( ) throws IOException { StringBuffer buffer = null ; while ( true ) { Tokenizer . Token t = get ( ) ; if ( ! t . isString ( ) ) break ; if ( buffer == null ) buffer = new StringBuffer ( ) ; buffer . append ( t . value ) ; } unget ( ) ; if ( buffer == null ) return null ; return buffer ....
Returns a concatenation of the remaining strings from a Tokenizer .
91
14
41,947
public byte [ ] getHexString ( ) throws IOException { String next = _getIdentifier ( "a hex string" ) ; byte [ ] array = base16 . fromString ( next ) ; if ( array == null ) throw exception ( "invalid hex encoding" ) ; return array ; }
Gets the next token from a tokenizer and decodes it as hex .
64
16
41,948
public byte [ ] getBase32String ( base32 b32 ) throws IOException { String next = _getIdentifier ( "a base32 string" ) ; byte [ ] array = b32 . fromString ( next ) ; if ( array == null ) throw exception ( "invalid base32 encoding" ) ; return array ; }
Gets the next token from a tokenizer and decodes it as base32 .
70
17
41,949
public static int compare ( long serial1 , long serial2 ) { if ( serial1 < 0 || serial1 > MAX32 ) throw new IllegalArgumentException ( serial1 + " out of range" ) ; if ( serial2 < 0 || serial2 > MAX32 ) throw new IllegalArgumentException ( serial2 + " out of range" ) ; long diff = serial1 - serial2 ; if ( diff >= MAX32...
Compares two numbers using serial arithmetic . The numbers are assumed to be 32 bit unsigned integers stored in longs .
124
23
41,950
public static long increment ( long serial ) { if ( serial < 0 || serial > MAX32 ) throw new IllegalArgumentException ( serial + " out of range" ) ; if ( serial == MAX32 ) return 0 ; return serial + 1 ; }
Increments a serial number . The number is assumed to be a 32 bit unsigned integer stored in a long . This basically adds 1 and resets the value to 0 if it is 2^32 .
52
40
41,951
public Message send ( Message query ) throws IOException { if ( Options . check ( "verbose" ) ) System . err . println ( "Sending to " + address . getAddress ( ) . getHostAddress ( ) + ":" + address . getPort ( ) ) ; if ( query . getHeader ( ) . getOpcode ( ) == Opcode . QUERY ) { Record question = query . getQuestion ...
Sends a message to a single server and waits for a response . No checking is done to ensure that the response is associated with the query .
558
29
41,952
public Object sendAsync ( final Message query , final ResolverListener listener ) { final Object id ; synchronized ( this ) { id = new Integer ( uniqueID ++ ) ; } Record question = query . getQuestion ( ) ; String qname ; if ( question != null ) qname = question . getName ( ) . toString ( ) ; else qname = "(none)" ; St...
Asynchronously sends a message to a single server registering a listener to receive a callback on success or exception . Multiple asynchronous lookups can be performed in parallel . Since the callback may be invoked before the function returns external synchronization is necessary .
140
47
41,953
public static void set ( String option ) { if ( table == null ) table = new HashMap ( ) ; table . put ( option . toLowerCase ( ) , "true" ) ; }
Sets an option to true
41
6
41,954
public static boolean check ( String option ) { if ( table == null ) return false ; return ( table . get ( option . toLowerCase ( ) ) != null ) ; }
Checks if an option is defined
37
7
41,955
public static String value ( String option ) { if ( table == null ) return null ; return ( ( String ) table . get ( option . toLowerCase ( ) ) ) ; }
Returns the value of an option
38
6
41,956
public static int intValue ( String option ) { String s = value ( option ) ; if ( s != null ) { try { int val = Integer . parseInt ( s ) ; if ( val > 0 ) return ( val ) ; } catch ( NumberFormatException e ) { } } return ( - 1 ) ; }
Returns the value of an option as an integer or - 1 if not defined .
67
16
41,957
public void run ( ) { try { Message response = res . send ( query ) ; listener . receiveMessage ( id , response ) ; } catch ( Exception e ) { listener . handleException ( id , e ) ; } }
Performs the query and executes the callback .
47
9
41,958
String rrToString ( ) { StringBuffer sb = new StringBuffer ( ) ; sb . append ( byteArrayToString ( cpu , true ) ) ; sb . append ( " " ) ; sb . append ( byteArrayToString ( os , true ) ) ; return sb . toString ( ) ; }
Converts to a string
70
5
41,959
public RRset [ ] answers ( ) { if ( type != SUCCESSFUL ) return null ; List l = ( List ) data ; return ( RRset [ ] ) l . toArray ( new RRset [ l . size ( ) ] ) ; }
If the query was successful return the answers
54
8
41,960
public static Record newRecord ( Name name , int type , int dclass , long ttl ) { if ( ! name . isAbsolute ( ) ) throw new RelativeNameException ( name ) ; Type . check ( type ) ; DClass . check ( dclass ) ; TTL . check ( ttl ) ; return getEmptyRecord ( name , type , dclass , ttl , false ) ; }
Creates a new empty record with the given parameters .
84
11
41,961
public static Record newRecord ( Name name , int type , int dclass ) { return newRecord ( name , type , dclass , 0 ) ; }
Creates a new empty record with the given parameters . This method is designed to create records that will be added to the QUERY section of a message .
32
31
41,962
public static Record fromWire ( byte [ ] b , int section ) throws IOException { return fromWire ( new DNSInput ( b ) , section , false ) ; }
Builds a Record from DNS uncompressed wire format .
35
11
41,963
public byte [ ] toWire ( int section ) { DNSOutput out = new DNSOutput ( ) ; toWire ( out , section , null ) ; return out . toByteArray ( ) ; }
Converts a Record into DNS uncompressed wire format .
41
11
41,964
protected static byte [ ] byteArrayFromString ( String s ) throws TextParseException { byte [ ] array = s . getBytes ( ) ; boolean escaped = false ; boolean hasEscapes = false ; for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] == ' ' ) { hasEscapes = true ; break ; } } if ( ! hasEscapes ) { if ( array ....
Converts a String into a byte array .
388
9
41,965
protected static String byteArrayToString ( byte [ ] array , boolean quote ) { StringBuffer sb = new StringBuffer ( ) ; if ( quote ) sb . append ( ' ' ) ; for ( int i = 0 ; i < array . length ; i ++ ) { int b = array [ i ] & 0xFF ; if ( b < 0x20 || b >= 0x7f ) { sb . append ( ' ' ) ; sb . append ( byteFormat . format (...
Converts a byte array into a String .
181
9
41,966
protected static String unknownToString ( byte [ ] data ) { StringBuffer sb = new StringBuffer ( ) ; sb . append ( "\\# " ) ; sb . append ( data . length ) ; sb . append ( " " ) ; sb . append ( base16 . toString ( data ) ) ; return sb . toString ( ) ; }
Converts a byte array into the unknown RR format .
79
11
41,967
public boolean sameRRset ( Record rec ) { return ( getRRsetType ( ) == rec . getRRsetType ( ) && dclass == rec . dclass && name . equals ( rec . name ) ) ; }
Determines if two Records could be part of the same RRset . This compares the name type and class of the Records ; the ttl and rdata are not compared .
47
36
41,968
public String printFlags ( ) { StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < 16 ; i ++ ) if ( validFlag ( i ) && getFlag ( i ) ) { sb . append ( Flags . string ( i ) ) ; sb . append ( " " ) ; } return sb . toString ( ) ; }
Converts the header s flags into a String
80
9
41,969
public static synchronized Cache getDefaultCache ( int dclass ) { DClass . check ( dclass ) ; Cache c = ( Cache ) defaultCaches . get ( Mnemonic . toInteger ( dclass ) ) ; if ( c == null ) { c = new Cache ( dclass ) ; defaultCaches . put ( Mnemonic . toInteger ( dclass ) , c ) ; } return c ; }
Gets the Cache that will be used as the default for the specified class by future Lookups .
85
20
41,970
public static synchronized void setDefaultCache ( Cache cache , int dclass ) { DClass . check ( dclass ) ; defaultCaches . put ( Mnemonic . toInteger ( dclass ) , cache ) ; }
Sets the Cache to be used as the default for the specified class by future Lookups .
45
19
41,971
public static synchronized void setDefaultSearchPath ( String [ ] domains ) throws TextParseException { if ( domains == null ) { defaultSearchPath = null ; return ; } Name [ ] newdomains = new Name [ domains . length ] ; for ( int i = 0 ; i < domains . length ; i ++ ) newdomains [ i ] = Name . fromString ( domains [ i ...
Sets the search path that will be used as the default by future Lookups .
98
17
41,972
public void setSearchPath ( String [ ] domains ) throws TextParseException { if ( domains == null ) { this . searchPath = null ; return ; } Name [ ] newdomains = new Name [ domains . length ] ; for ( int i = 0 ; i < domains . length ; i ++ ) newdomains [ i ] = Name . fromString ( domains [ i ] , Name . root ) ; this . ...
Sets the search path to use when performing this lookup . This overrides the default value .
97
19
41,973
public void setCache ( Cache cache ) { if ( cache == null ) { this . cache = new Cache ( dclass ) ; this . temporary_cache = true ; } else { this . cache = cache ; this . temporary_cache = false ; } }
Sets the cache to use when performing this lookup . This overrides the default value . If the results of this lookup should not be permanently cached null can be provided here .
54
35
41,974
public Record [ ] run ( ) { if ( done ) reset ( ) ; if ( name . isAbsolute ( ) ) resolve ( name , null ) ; else if ( searchPath == null ) resolve ( name , Name . root ) ; else { if ( name . labels ( ) > defaultNdots ) resolve ( name , Name . root ) ; if ( done ) return answers ; for ( int i = 0 ; i < searchPath . lengt...
Performs the lookup using the specified Cache Resolver and search path .
300
14
41,975
public String getErrorString ( ) { checkDone ( ) ; if ( error != null ) return error ; switch ( result ) { case SUCCESSFUL : return "successful" ; case UNRECOVERABLE : return "unrecoverable error" ; case TRY_AGAIN : return "try again" ; case HOST_NOT_FOUND : return "host not found" ; case TYPE_NOT_FOUND : return "type ...
Returns an error string describing the result code of this lookup .
112
12
41,976
public static int value ( String s , boolean numberok ) { int val = types . getValue ( s ) ; if ( val == - 1 && numberok ) { val = types . getValue ( "TYPE" + s ) ; } return val ; }
Converts a String representation of an Type into its numeric value .
54
13
41,977
public InetAddress getAddress ( ) { try { if ( name == null ) return InetAddress . getByAddress ( address ) ; else return InetAddress . getByAddress ( name . toString ( ) , address ) ; } catch ( UnknownHostException e ) { return null ; } }
Returns the address
63
3
41,978
public synchronized void addRR ( Record r ) { if ( rrs . size ( ) == 0 ) { safeAddRR ( r ) ; return ; } Record first = first ( ) ; if ( ! r . sameRRset ( first ) ) throw new IllegalArgumentException ( "record does not match " + "rrset" ) ; if ( r . getTTL ( ) != first . getTTL ( ) ) { if ( r . getTTL ( ) > first . getT...
Adds a Record to an RRset
226
7
41,979
private boolean findProperty ( ) { String prop ; List lserver = new ArrayList ( 0 ) ; List lsearch = new ArrayList ( 0 ) ; StringTokenizer st ; prop = System . getProperty ( "dns.server" ) ; if ( prop != null ) { st = new StringTokenizer ( prop , "," ) ; while ( st . hasMoreTokens ( ) ) addServer ( st . nextToken ( ) ,...
Looks in the system properties to find servers and a search path . Servers are defined by dns . server = server1 server2 ... The search path is defined by dns . search = domain1 domain2 ...
182
44
41,980
private void find95 ( ) { String s = "winipcfg.out" ; try { Process p ; p = Runtime . getRuntime ( ) . exec ( "winipcfg /all /batch " + s ) ; p . waitFor ( ) ; File f = new File ( s ) ; findWin ( new FileInputStream ( f ) ) ; new File ( s ) . delete ( ) ; } catch ( Exception e ) { return ; } }
Calls winipcfg and parses the result to find servers and a search path .
96
18
41,981
private void findNT ( ) { try { Process p ; p = Runtime . getRuntime ( ) . exec ( "ipconfig /all" ) ; findWin ( p . getInputStream ( ) ) ; p . destroy ( ) ; } catch ( Exception e ) { return ; } }
Calls ipconfig and parses the result to find servers and a search path .
60
17
41,982
public void writeU16 ( int val ) { check ( val , 16 ) ; need ( 2 ) ; array [ pos ++ ] = ( byte ) ( ( val >>> 8 ) & 0xFF ) ; array [ pos ++ ] = ( byte ) ( val & 0xFF ) ; }
Writes an unsigned 16 bit value to the stream .
61
11
41,983
public void writeU16At ( int val , int where ) { check ( val , 16 ) ; if ( where > pos - 2 ) throw new IllegalArgumentException ( "cannot write past " + "end of data" ) ; array [ where ++ ] = ( byte ) ( ( val >>> 8 ) & 0xFF ) ; array [ where ++ ] = ( byte ) ( val & 0xFF ) ; }
Writes an unsigned 16 bit value to the specified position in the stream .
89
15
41,984
public void writeU32 ( long val ) { check ( val , 32 ) ; need ( 4 ) ; array [ pos ++ ] = ( byte ) ( ( val >>> 24 ) & 0xFF ) ; array [ pos ++ ] = ( byte ) ( ( val >>> 16 ) & 0xFF ) ; array [ pos ++ ] = ( byte ) ( ( val >>> 8 ) & 0xFF ) ; array [ pos ++ ] = ( byte ) ( val & 0xFF ) ; }
Writes an unsigned 32 bit value to the stream .
103
11
41,985
public void writeByteArray ( byte [ ] b , int off , int len ) { need ( len ) ; System . arraycopy ( b , off , array , pos , len ) ; pos += len ; }
Writes a byte array to the stream .
44
9
41,986
public void writeCountedString ( byte [ ] s ) { if ( s . length > 0xFF ) { throw new IllegalArgumentException ( "Invalid counted string" ) ; } need ( 1 + s . length ) ; array [ pos ++ ] = ( byte ) ( s . length & 0xFF ) ; writeByteArray ( s , 0 , s . length ) ; }
Writes a counted string from the stream . A counted string is a one byte value indicating string length followed by bytes of data .
81
26
41,987
public byte [ ] hashName ( Name name ) throws NoSuchAlgorithmException { return NSEC3Record . hashName ( name , hashAlg , iterations , salt ) ; }
Hashes a name with the parameters of this NSEC3PARAM record .
38
16
41,988
public static boolean supportedType ( int type ) { Type . check ( type ) ; return ( type == Type . PTR || type == Type . CNAME || type == Type . DNAME || type == Type . A || type == Type . AAAA || type == Type . NS ) ; }
Indicates whether generation is supported for this type .
61
10
41,989
public Record nextRecord ( ) throws IOException { if ( current > end ) return null ; String namestr = substitute ( namePattern , current ) ; Name name = Name . fromString ( namestr , origin ) ; String rdata = substitute ( rdataPattern , current ) ; current += step ; return Record . fromString ( name , type , dclass , t...
Constructs and returns the next record in the expansion .
89
11
41,990
public Record [ ] expand ( ) throws IOException { List list = new ArrayList ( ) ; for ( long i = start ; i < end ; i += step ) { String namestr = substitute ( namePattern , current ) ; Name name = Name . fromString ( namestr , origin ) ; String rdata = substitute ( rdataPattern , current ) ; list . add ( Record . fromS...
Constructs and returns all records in the expansion .
129
10
41,991
String rrToString ( ) { StringBuffer sb = new StringBuffer ( ) ; sb . append ( mailbox ) ; sb . append ( " " ) ; sb . append ( textDomain ) ; return sb . toString ( ) ; }
Converts the RP Record to a String
55
8
41,992
public static String format ( Date date ) { Calendar c = new GregorianCalendar ( TimeZone . getTimeZone ( "UTC" ) ) ; StringBuffer sb = new StringBuffer ( ) ; c . setTime ( date ) ; sb . append ( w4 . format ( c . get ( Calendar . YEAR ) ) ) ; sb . append ( w2 . format ( c . get ( Calendar . MONTH ) + 1 ) ) ; sb . appe...
Converts a Date into a formatted string .
201
9
41,993
public static Date parse ( String s ) throws TextParseException { if ( s . length ( ) != 14 ) { throw new TextParseException ( "Invalid time encoding: " + s ) ; } Calendar c = new GregorianCalendar ( TimeZone . getTimeZone ( "UTC" ) ) ; c . clear ( ) ; try { int year = Integer . parseInt ( s . substring ( 0 , 4 ) ) ; i...
Parses a formatted time string into a Date .
242
11
41,994
public InetAddress getAddress ( ) { try { if ( name == null ) return InetAddress . getByAddress ( toArray ( addr ) ) ; else return InetAddress . getByAddress ( name . toString ( ) , toArray ( addr ) ) ; } catch ( UnknownHostException e ) { return null ; } }
Returns the Internet address
71
4
41,995
String rrToString ( ) { StringBuffer sb = new StringBuffer ( ) ; sb . append ( responsibleAddress ) ; sb . append ( " " ) ; sb . append ( errorAddress ) ; return sb . toString ( ) ; }
Converts the MINFO Record to a String
56
9
41,996
public static void verify ( RRset rrset , RRSIGRecord rrsig , DNSKEYRecord key ) throws DNSSECException { if ( ! matches ( rrsig , key ) ) throw new KeyMismatchException ( key , rrsig ) ; Date now = new Date ( ) ; if ( now . compareTo ( rrsig . getExpire ( ) ) > 0 ) throw new SignatureExpiredException ( rrsig . getExpi...
Verify a DNSSEC signature .
193
8
41,997
static byte [ ] generateDSDigest ( DNSKEYRecord key , int digestid ) { MessageDigest digest ; try { switch ( digestid ) { case DSRecord . Digest . SHA1 : digest = MessageDigest . getInstance ( "sha-1" ) ; break ; case DSRecord . Digest . SHA256 : digest = MessageDigest . getInstance ( "sha-256" ) ; break ; case DSRecor...
Generate the digest value for a DS key
235
9
41,998
private static Map < String , String > parseKeyValueMap ( String kvString , Function < String , String > valueMapper ) { return Stream . of ( Optional . ofNullable ( kvString ) . map ( StringUtils :: trimAllWhitespace ) . filter ( StringUtils :: hasText ) . map ( s -> s . split ( PAIR_SEPARATOR ) ) . orElse ( new Strin...
Parses a key - value pair string such as param1 = WdfaA param2 = AZrr param3 into a map .
178
29
41,999
public boolean setNonnull ( HttpResponse response ) { Preconditions . checkNotNull ( response ) ; if ( set ( response ) ) { callback . completed ( response ) ; return true ; } else { return false ; } }
superclass method has
49
4