idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
25,700
public String getRelativePath ( ) { StringBuilder sb = new StringBuilder ( ) ; String pkg = typeRef . getPackageName ( ) . replace ( '.' , '/' ) ; if ( pkg . length ( ) > 0 ) { sb . append ( pkg ) ; sb . append ( '/' ) ; } appendDeclaringTypes ( typeRef , '$' , sb ) ; sb . append ( typeRef . getSimpleName ( ) ) ; sb . ...
Returns the relative classfile path .
25,701
private static void appendDeclaringTypes ( TypeReference typeRef , char innerClassDelimiter , StringBuilder sb ) { TypeReference declaringType = typeRef . getDeclaringType ( ) ; if ( declaringType != null ) { appendDeclaringTypes ( declaringType , innerClassDelimiter , sb ) ; sb . append ( declaringType . getSimpleName...
Recurse depth - first so order of declaring types is correct .
25,702
public FieldDeclaration getFieldNode ( String name , String signature ) { for ( EntityDeclaration node : type . getMembers ( ) ) { if ( node . getEntityType ( ) == EntityType . FIELD ) { FieldDeclaration field = ( FieldDeclaration ) node ; if ( field . getName ( ) . equals ( name ) && signature ( field . getReturnType ...
Returns the Procyon field definition for a specified variable or null if not found .
25,703
public MethodDeclaration getMethod ( String name , String signature ) { for ( EntityDeclaration node : type . getMembers ( ) ) { if ( node . getEntityType ( ) == EntityType . METHOD ) { MethodDeclaration method = ( MethodDeclaration ) node ; if ( method . getName ( ) . equals ( name ) && signature . equals ( signature ...
Returns the Procyon method definition for a specified method or null if not found .
25,704
public ConstructorDeclaration getConstructor ( String signature ) { for ( EntityDeclaration node : type . getMembers ( ) ) { if ( node . getEntityType ( ) == EntityType . CONSTRUCTOR ) { ConstructorDeclaration cons = ( ConstructorDeclaration ) node ; if ( signature . equals ( signature ( cons ) ) ) { return cons ; } } ...
Returns the Procyon method definition for a specified constructor or null if not found .
25,705
public static BasicPeriodFormatterService getInstance ( ) { if ( instance == null ) { PeriodFormatterDataService ds = ResourceBasedPeriodFormatterDataService . getInstance ( ) ; instance = new BasicPeriodFormatterService ( ds ) ; } return instance ; }
Return the default service instance . This uses the default data service .
25,706
public final Result get ( long timeout , TimeUnit unit ) throws InterruptedException , ExecutionException , TimeoutException { return mFuture . get ( timeout , unit ) ; }
Waits if necessary for at most the given time for the computation to complete and then retrieves its result .
25,707
public void setText ( String text ) { if ( text == null ) { throw new NullPointerException ( ) ; } this . text = text ; this . begin = 0 ; this . end = text . length ( ) ; this . pos = 0 ; }
Reset this iterator to point to a new string . This package - visible method is used by other java . text classes that want to avoid allocating new StringCharacterIterator objects every time their setText method is called .
25,708
public static boolean isBlockOrSF ( String s ) { if ( s . endsWith ( ".SF" ) || s . endsWith ( ".DSA" ) || s . endsWith ( ".RSA" ) || s . endsWith ( ".EC" ) ) { return true ; } return false ; }
Utility method used by JarVerifier and JarSigner to determine the signature file names and PKCS7 block files names that are supported
25,709
private MessageDigest getDigest ( String algorithm ) { if ( createdDigests == null ) createdDigests = new HashMap < String , MessageDigest > ( ) ; MessageDigest digest = createdDigests . get ( algorithm ) ; if ( digest == null ) { try { digest = MessageDigest . getInstance ( algorithm ) ; createdDigests . put ( algorit...
get digest from cache
25,710
public void process ( Hashtable < String , CodeSigner [ ] > signers , List manifestDigests ) throws IOException , SignatureException , NoSuchAlgorithmException , JarException , CertificateException { Object obj = null ; try { obj = Providers . startJarVerification ( ) ; processImpl ( signers , manifestDigests ) ; } fin...
process the signature block file . Goes through the . SF file and adds code signers for each section where the . SF section hash was verified against the Manifest section .
25,711
private boolean verifyManifestHash ( Manifest sf , ManifestDigester md , BASE64Decoder decoder , List manifestDigests ) throws IOException { Attributes mattr = sf . getMainAttributes ( ) ; boolean manifestSigned = false ; for ( Map . Entry < Object , Object > se : mattr . entrySet ( ) ) { String key = se . getKey ( ) ....
See if the whole manifest was signed .
25,712
private boolean verifySection ( Attributes sfAttr , String name , ManifestDigester md , BASE64Decoder decoder ) throws IOException { boolean oneDigestVerified = false ; ManifestDigester . Entry mde = md . get ( name , block . isOldStyle ( ) ) ; if ( mde == null ) { throw new SecurityException ( "no manifiest section fo...
given the . SF digest header and the data from the section in the manifest see if the hashes match . if not throw a SecurityException .
25,713
static String toHex ( byte [ ] data ) { StringBuffer sb = new StringBuffer ( data . length * 2 ) ; for ( int i = 0 ; i < data . length ; i ++ ) { sb . append ( hexc [ ( data [ i ] >> 4 ) & 0x0f ] ) ; sb . append ( hexc [ data [ i ] & 0x0f ] ) ; } return sb . toString ( ) ; }
convert a byte array to a hex string for debugging purposes
25,714
static boolean contains ( CodeSigner [ ] set , CodeSigner signer ) { for ( int i = 0 ; i < set . length ; i ++ ) { if ( set [ i ] . equals ( signer ) ) return true ; } return false ; }
returns true if set contains signer
25,715
static boolean isSubSet ( CodeSigner [ ] subset , CodeSigner [ ] set ) { if ( set == subset ) return true ; boolean match ; for ( int i = 0 ; i < subset . length ; i ++ ) { if ( ! contains ( set , subset [ i ] ) ) return false ; } return true ; }
returns true if subset is a subset of set
25,716
static boolean matches ( CodeSigner [ ] signers , CodeSigner [ ] oldSigners , CodeSigner [ ] newSigners ) { if ( ( oldSigners == null ) && ( signers == newSigners ) ) return true ; boolean match ; if ( ( oldSigners != null ) && ! isSubSet ( oldSigners , signers ) ) return false ; if ( ! isSubSet ( newSigners , signers ...
returns true if signer contains exactly the same code signers as oldSigner and newSigner false otherwise . oldSigner is allowed to be null .
25,717
static Object newInstance ( ClassLoader classLoader , String className ) throws ClassNotFoundException , IllegalAccessException , InstantiationException { Class driverClass ; if ( classLoader == null ) { driverClass = Class . forName ( className ) ; } else { driverClass = classLoader . loadClass ( className ) ; } retur...
Creates a new instance of the specified class name
25,718
public void putNextEntry ( ZipEntry ze ) throws IOException { if ( firstEntry ) { byte [ ] edata = ze . getExtra ( ) ; if ( edata == null || ! hasMagic ( edata ) ) { if ( edata == null ) { edata = new byte [ 4 ] ; } else { byte [ ] tmp = new byte [ edata . length + 4 ] ; System . arraycopy ( edata , 0 , tmp , 4 , edata...
Begins writing a new JAR file entry and positions the stream to the start of the entry data . This method will also close any previous entry . The default compression method will be used if no compression method was specified for the entry . The current time will be used if the entry has no set modification time .
25,719
protected void printInstanceVariables ( ) { Iterable < VariableDeclarationFragment > fields = getInstanceFields ( ) ; if ( Iterables . isEmpty ( fields ) ) { newline ( ) ; return ; } println ( " {" ) ; println ( " @public" ) ; indent ( ) ; FieldDeclaration lastDeclaration = null ; boolean needsAsterisk = false ; for ( ...
Prints the list of instance variables in a type .
25,720
protected void printDeadClassConstant ( VariableDeclarationFragment fragment ) { VariableElement var = fragment . getVariableElement ( ) ; Object value = var . getConstantValue ( ) ; assert value != null ; String declType = getDeclarationType ( var ) ; declType += ( declType . endsWith ( "*" ) ? "" : " " ) ; String nam...
Overridden in TypePrivateDeclarationGenerator
25,721
private void printMethodDeclaration ( MethodDeclaration m , boolean isCompanionClass ) { ExecutableElement methodElement = m . getExecutableElement ( ) ; TypeElement typeElement = ElementUtil . getDeclaringClass ( methodElement ) ; if ( typeElement . getKind ( ) . isInterface ( ) ) { if ( isCompanionClass != ElementUti...
Emit method declaration .
25,722
protected String nullability ( Element element ) { if ( options . nullability ( ) ) { if ( ElementUtil . hasNullableAnnotation ( element ) ) { return " __nullable" ; } if ( ElementUtil . isNonnull ( element , parametersNonnullByDefault ) ) { return " __nonnull" ; } } return "" ; }
Returns an Objective - C nullability attribute string if there is a matching JSR305 annotation or an empty string .
25,723
private long mappingOffset ( ) { int ps = Bits . pageSize ( ) ; long offset = address % ps ; return ( offset >= 0 ) ? offset : ( ps + offset ) ; }
of the mapping . Computed each time to avoid storing in every direct buffer .
25,724
public final boolean isLoaded ( ) { checkMapped ( ) ; if ( ( address == 0 ) || ( capacity ( ) == 0 ) ) return true ; long offset = mappingOffset ( ) ; long length = mappingLength ( offset ) ; return isLoaded0 ( mappingAddress ( offset ) , length , Bits . pageCount ( length ) ) ; }
Tells whether or not this buffer s content is resident in physical memory .
25,725
public final MappedByteBuffer load ( ) { checkMapped ( ) ; if ( ( address == 0 ) || ( capacity ( ) == 0 ) ) return this ; long offset = mappingOffset ( ) ; long length = mappingLength ( offset ) ; load0 ( mappingAddress ( offset ) , length ) ; Unsafe unsafe = Unsafe . getUnsafe ( ) ; int ps = Bits . pageSize ( ) ; int ...
Loads this buffer s content into physical memory .
25,726
public final MappedByteBuffer force ( ) { checkMapped ( ) ; if ( ( address != 0 ) && ( capacity ( ) != 0 ) ) { long offset = mappingOffset ( ) ; force0 ( fd , mappingAddress ( offset ) , mappingLength ( offset ) ) ; } return this ; }
Forces any changes made to this buffer s content to be written to the storage device containing the mapped file .
25,727
public static ListFormatter getInstance ( Locale locale ) { return getInstance ( ULocale . forLocale ( locale ) , Style . STANDARD ) ; }
Create a list formatter that is appropriate for a locale .
25,728
public static ListFormatter getInstance ( ULocale locale , Style style ) { return cache . get ( locale , style . getName ( ) ) ; }
Create a list formatter that is appropriate for a locale and style .
25,729
FormattedListBuilder format ( Collection < ? > items , int index ) { Iterator < ? > it = items . iterator ( ) ; int count = items . size ( ) ; switch ( count ) { case 0 : return new FormattedListBuilder ( "" , false ) ; case 1 : return new FormattedListBuilder ( it . next ( ) , index == 0 ) ; case 2 : return new Format...
the offset .
25,730
public String getPatternForNumItems ( int count ) { if ( count <= 0 ) { throw new IllegalArgumentException ( "count must be > 0" ) ; } ArrayList < String > list = new ArrayList < String > ( ) ; for ( int i = 0 ; i < count ; i ++ ) { list . add ( String . format ( "{%d}" , i ) ) ; } return format ( list ) ; }
Returns the pattern to use for a particular item count .
25,731
public void markUsedElements ( CodeReferenceMap publicRootSet ) { if ( publicRootSet == null ) { markUsedElements ( ) ; return ; } for ( String clazz : publicRootSet . getReferencedClasses ( ) ) { ClassReferenceNode classNode = ( ClassReferenceNode ) elementReferenceMap . get ( ElementReferenceMapper . stitchClassIdent...
the isPublic check .
25,732
public void traverseMethod ( String methodID ) { MethodReferenceNode node = ( MethodReferenceNode ) elementReferenceMap . get ( methodID ) ; if ( node == null ) { ErrorUtil . warning ( "Encountered .class method while accessing: " + methodID ) ; return ; } if ( node . reachable ) { return ; } node . reachable = true ; ...
Traverses the method invocation graph created by ElementReferenceMapper and marks all methods that are reachable from the inputRootSet . Also covers all methods that possibly override these called methods .
25,733
public final void init ( int opmode , Key key ) throws InvalidKeyException { init ( opmode , key , JceSecurity . RANDOM ) ; }
Initializes this cipher with a key .
25,734
public final void init ( int opmode , Key key , SecureRandom random ) throws InvalidKeyException { initialized = false ; checkOpmode ( opmode ) ; try { chooseProvider ( InitType . KEY , opmode , key , null , null , random ) ; } catch ( InvalidAlgorithmParameterException e ) { throw new InvalidKeyException ( e ) ; } ini...
Initializes this cipher with a key and a source of randomness .
25,735
public final void init ( int opmode , Key key , AlgorithmParameterSpec params , SecureRandom random ) throws InvalidKeyException , InvalidAlgorithmParameterException { initialized = false ; checkOpmode ( opmode ) ; chooseProvider ( InitType . ALGORITHM_PARAM_SPEC , opmode , key , params , null , random ) ; initialized ...
Initializes this cipher with a key a set of algorithm parameters and a source of randomness .
25,736
public final void init ( int opmode , Certificate certificate , SecureRandom random ) throws InvalidKeyException { initialized = false ; checkOpmode ( opmode ) ; if ( certificate instanceof java . security . cert . X509Certificate ) { X509Certificate cert = ( X509Certificate ) certificate ; Set critSet = cert . getCrit...
Initializes this cipher with the public key from the given certificate and a source of randomness .
25,737
public final int doFinal ( byte [ ] output , int outputOffset ) throws IllegalBlockSizeException , ShortBufferException , BadPaddingException { checkCipherState ( ) ; if ( ( output == null ) || ( outputOffset < 0 ) ) { throw new IllegalArgumentException ( "Bad arguments" ) ; } updateProviderIfNeeded ( ) ; return spi . ...
Finishes a multiple - part encryption or decryption operation depending on how this cipher was initialized .
25,738
public final byte [ ] wrap ( Key key ) throws IllegalBlockSizeException , InvalidKeyException { if ( ! ( this instanceof NullCipher ) ) { if ( ! initialized ) { throw new IllegalStateException ( "Cipher not initialized" ) ; } if ( opmode != Cipher . WRAP_MODE ) { throw new IllegalStateException ( "Cipher not initialize...
Wrap a key .
25,739
public final Key unwrap ( byte [ ] wrappedKey , String wrappedKeyAlgorithm , int wrappedKeyType ) throws InvalidKeyException , NoSuchAlgorithmException { if ( ! ( this instanceof NullCipher ) ) { if ( ! initialized ) { throw new IllegalStateException ( "Cipher not initialized" ) ; } if ( opmode != Cipher . UNWRAP_MODE ...
Unwrap a previously wrapped key .
25,740
public static final AlgorithmParameterSpec getMaxAllowedParameterSpec ( String transformation ) throws NoSuchAlgorithmException { if ( transformation == null ) { throw new NullPointerException ( "transformation == null" ) ; } tokenizeTransformation ( transformation ) ; return null ; }
Returns an AlgorithmParameterSpec object which contains the maximum cipher parameter value according to the jurisdiction policy file . If JCE unlimited strength jurisdiction policy files are installed or there is no maximum limit on the parameters for the specified transformation in the policy file null will be returne...
25,741
static boolean matchAttribute ( Provider . Service service , String attr , String value ) { if ( value == null ) { return true ; } final String pattern = service . getAttribute ( attr ) ; if ( pattern == null ) { return true ; } final String valueUc = value . toUpperCase ( Locale . US ) ; return valueUc . matches ( pat...
If the attribute listed exists check that it matches the regular expression .
25,742
private final Node registerNode ( Node newNode ) { if ( state == State . BUILDING_FAST ) { return newNode ; } Node oldNode = nodes . get ( newNode ) ; if ( oldNode != null ) { return oldNode ; } oldNode = nodes . put ( newNode , newNode ) ; assert ( oldNode == null ) ; return newNode ; }
Makes sure that there is only one unique node registered that is equivalent to newNode unless BUILDING_FAST .
25,743
private final ValueNode registerFinalValue ( int value ) { lookupFinalValueNode . setFinalValue ( value ) ; Node oldNode = nodes . get ( lookupFinalValueNode ) ; if ( oldNode != null ) { return ( ValueNode ) oldNode ; } ValueNode newNode = new ValueNode ( value ) ; oldNode = nodes . put ( newNode , newNode ) ; assert (...
Makes sure that there is only one unique FinalValueNode registered with this value . Avoids creating a node if the value is a duplicate .
25,744
protected Stylesheet getStylesheetRoot ( StylesheetHandler handler ) throws TransformerConfigurationException { StylesheetRoot stylesheet ; stylesheet = new StylesheetRoot ( handler . getSchema ( ) , handler . getStylesheetProcessor ( ) . getErrorListener ( ) ) ; if ( handler . getStylesheetProcessor ( ) . isSecureProc...
This method could be over - ridden by a class that extends this class .
25,745
public String createTypeSignature ( TypeMirror type ) { StringBuilder sb = new StringBuilder ( ) ; genTypeSignature ( type , sb ) ; return sb . toString ( ) ; }
Create a signature for a specified type .
25,746
public String createClassSignature ( TypeElement type ) { if ( ! hasGenericSignature ( type ) ) { return null ; } StringBuilder sb = new StringBuilder ( ) ; genClassSignature ( type , sb ) ; return sb . toString ( ) ; }
Create a class signature string for a specified type .
25,747
public String createFieldTypeSignature ( VariableElement variable ) { if ( ! hasGenericSignature ( variable . asType ( ) ) ) { return null ; } StringBuilder sb = new StringBuilder ( ) ; genTypeSignature ( variable . asType ( ) , sb ) ; return sb . toString ( ) ; }
Create a field signature string for a specified variable .
25,748
public String createMethodTypeSignature ( ExecutableElement method ) { if ( ! hasGenericSignature ( method ) ) { return null ; } StringBuilder sb = new StringBuilder ( ) ; genMethodTypeSignature ( method , sb ) ; return sb . toString ( ) ; }
Create a method signature string for a specified method or constructor .
25,749
public static void checkSuperClass ( Service s , Class < ? > subClass , Class < ? > superClass ) throws NoSuchAlgorithmException { if ( superClass == null ) { return ; } if ( superClass . isAssignableFrom ( subClass ) == false ) { throw new NoSuchAlgorithmException ( "class configured for " + s . getType ( ) + ": " + s...
Check is subClass is a subclass of superClass . If not throw a NoSuchAlgorithmException .
25,750
protected void engineInitSign ( PrivateKey privateKey , SecureRandom random ) throws InvalidKeyException { this . appRandom = random ; engineInitSign ( privateKey ) ; }
Initializes this signature object with the specified private key and source of randomness for signing operations .
25,751
private void setMaxDelimCodePoint ( ) { if ( delimiters == null ) { maxDelimCodePoint = 0 ; return ; } int m = 0 ; int c ; int count = 0 ; for ( int i = 0 ; i < delimiters . length ( ) ; i += Character . charCount ( c ) ) { c = delimiters . charAt ( i ) ; if ( c >= Character . MIN_HIGH_SURROGATE && c <= Character . MAX...
Set maxDelimCodePoint to the highest char in the delimiter set .
25,752
private int skipDelimiters ( int startPos ) { if ( delimiters == null ) throw new NullPointerException ( ) ; int position = startPos ; while ( ! retDelims && position < maxPosition ) { if ( ! hasSurrogates ) { char c = str . charAt ( position ) ; if ( ( c > maxDelimCodePoint ) || ( delimiters . indexOf ( c ) < 0 ) ) br...
Skips delimiters starting from the specified position . If retDelims is false returns the index of the first non - delimiter character at or after startPos . If retDelims is true startPos is returned .
25,753
private int scanToken ( int startPos ) { int position = startPos ; while ( position < maxPosition ) { if ( ! hasSurrogates ) { char c = str . charAt ( position ) ; if ( ( c <= maxDelimCodePoint ) && ( delimiters . indexOf ( c ) >= 0 ) ) break ; position ++ ; } else { int c = str . codePointAt ( position ) ; if ( ( c <=...
Skips ahead from startPos and returns the index of the next delimiter character encountered or maxPosition if no such delimiter is found .
25,754
private void set ( int position , boolean val ) { if ( position >= bitString . length ) { boolean [ ] tmp = new boolean [ position + 1 ] ; System . arraycopy ( bitString , 0 , tmp , 0 , bitString . length ) ; bitString = tmp ; } bitString [ position ] = val ; }
Set the bit at the specified position .
25,755
public static void makeRules ( String description , NFRuleSet owner , NFRule predecessor , RuleBasedNumberFormat ownersOwner , List < NFRule > returnList ) { NFRule rule1 = new NFRule ( ownersOwner , description ) ; description = rule1 . ruleText ; int brack1 = description . indexOf ( '[' ) ; int brack2 = brack1 < 0 ? ...
Creates one or more rules based on the description passed in .
25,756
private void extractSubstitutions ( NFRuleSet owner , String ruleText , NFRule predecessor ) { this . ruleText = ruleText ; sub1 = extractSubstitution ( owner , predecessor ) ; if ( sub1 == null ) { sub2 = null ; } else { sub2 = extractSubstitution ( owner , predecessor ) ; } ruleText = this . ruleText ; int pluralRule...
Searches the rule s rule text for the substitution tokens creates the substitutions and removes the substitution tokens from the rule s rule text .
25,757
private NFSubstitution extractSubstitution ( NFRuleSet owner , NFRule predecessor ) { NFSubstitution result ; int subStart ; int subEnd ; subStart = indexOfAnyRulePrefix ( ruleText ) ; if ( subStart == - 1 ) { return null ; } if ( ruleText . startsWith ( ">>>" , subStart ) ) { subEnd = subStart + 2 ; } else { char c = ...
Searches the rule s rule text for the first substitution token creates a substitution based on it and removes the token from the rule s rule text .
25,758
final void setBaseValue ( long newBaseValue ) { baseValue = newBaseValue ; radix = 10 ; if ( baseValue >= 1 ) { exponent = expectedExponent ( ) ; if ( sub1 != null ) { sub1 . setDivisor ( radix , exponent ) ; } if ( sub2 != null ) { sub2 . setDivisor ( radix , exponent ) ; } } else { exponent = 0 ; } }
Sets the rule s base value and causes the radix and exponent to be recalculated . This is used during construction when we don t know the rule s base value until after it s been constructed . It should not be used at any other time .
25,759
private short expectedExponent ( ) { if ( radix == 0 || baseValue < 1 ) { return 0 ; } short tempResult = ( short ) ( Math . log ( baseValue ) / Math . log ( radix ) ) ; if ( power ( radix , ( short ) ( tempResult + 1 ) ) <= baseValue ) { return ( short ) ( tempResult + 1 ) ; } else { return tempResult ; } }
This calculates the rule s exponent based on its radix and base value . This will be the highest power the radix can be raised to and still produce a result less than or equal to the base value .
25,760
private static int indexOfAnyRulePrefix ( String ruleText ) { int result = - 1 ; if ( ruleText . length ( ) > 0 ) { int pos ; for ( String string : RULE_PREFIXES ) { pos = ruleText . indexOf ( string ) ; if ( pos != - 1 && ( result == - 1 || pos < result ) ) { result = pos ; } } } return result ; }
Searches the rule s rule text for any of the specified strings .
25,761
public void doFormat ( double number , StringBuilder toInsertInto , int pos , int recursionCount ) { int pluralRuleStart = ruleText . length ( ) ; int lengthOffset = 0 ; if ( rulePatternFormat == null ) { toInsertInto . insert ( pos , ruleText ) ; } else { pluralRuleStart = ruleText . indexOf ( "$(" ) ; int pluralRuleE...
Formats the number and inserts the resulting text into toInsertInto .
25,762
static long power ( long base , short exponent ) { if ( exponent < 0 ) { throw new IllegalArgumentException ( "Exponent can not be negative" ) ; } if ( base < 0 ) { throw new IllegalArgumentException ( "Base can not be negative" ) ; } long result = 1 ; while ( exponent > 0 ) { if ( ( exponent & 1 ) == 1 ) { result *= b...
This is an equivalent to Math . pow that accurately works on 64 - bit numbers
25,763
public Number doParse ( String text , ParsePosition parsePosition , boolean isFractionRule , double upperBound ) { ParsePosition pp = new ParsePosition ( 0 ) ; int sub1Pos = sub1 != null ? sub1 . getPos ( ) : ruleText . length ( ) ; int sub2Pos = sub2 != null ? sub2 . getPos ( ) : ruleText . length ( ) ; String workTex...
Attempts to parse the string with this rule .
25,764
private boolean allIgnorable ( String str ) { if ( str == null || str . length ( ) == 0 ) { return true ; } RbnfLenientScanner scanner = formatter . getLenientScanner ( ) ; return scanner != null && scanner . allIgnorable ( str ) ; }
Checks to see whether a string consists entirely of ignorable characters .
25,765
protected int serializeHeader ( DataOutputStream dos ) throws IOException { int bytesWritten = 0 ; dos . writeInt ( header . signature ) ; dos . writeShort ( header . options ) ; dos . writeShort ( header . indexLength ) ; dos . writeShort ( header . shiftedDataLength ) ; dos . writeShort ( header . index2NullOffset ) ...
Serialize a trie2 Header and Index onto an OutputStream . This is common code used for both the Trie2_16 and Trie2_32 serialize functions .
25,766
int rangeEnd ( int start , int limitp , int val ) { int c ; int limit = Math . min ( highStart , limitp ) ; for ( c = start + 1 ; c < limit ; c ++ ) { if ( get ( c ) != val ) { break ; } } if ( c >= highStart ) { c = limitp ; } return c - 1 ; }
Find the last character in a contiguous range of characters with the same Trie2 value as the input character .
25,767
public final synchronized void add ( String name , L listener ) { if ( this . map == null ) { this . map = new HashMap < > ( ) ; } L [ ] array = this . map . get ( name ) ; int size = ( array != null ) ? array . length : 0 ; L [ ] clone = newArray ( size + 1 ) ; clone [ size ] = listener ; if ( array != null ) { System...
Adds a listener to the list of listeners for the specified property . This listener is called as many times as it was added .
25,768
public final synchronized void remove ( String name , L listener ) { if ( this . map != null ) { L [ ] array = this . map . get ( name ) ; if ( array != null ) { for ( int i = 0 ; i < array . length ; i ++ ) { if ( listener . equals ( array [ i ] ) ) { int size = array . length - 1 ; if ( size > 0 ) { L [ ] clone = new...
Removes a listener from the list of listeners for the specified property . If the listener was added more than once to the same event source this listener will be notified one less time after being removed .
25,769
public final synchronized L [ ] get ( String name ) { return ( this . map != null ) ? this . map . get ( name ) : null ; }
Returns the list of listeners for the specified property .
25,770
public final void set ( String name , L [ ] listeners ) { if ( listeners != null ) { if ( this . map == null ) { this . map = new HashMap < > ( ) ; } this . map . put ( name , listeners ) ; } else if ( this . map != null ) { this . map . remove ( name ) ; if ( this . map . isEmpty ( ) ) { this . map = null ; } } }
Sets new list of listeners for the specified property .
25,771
public final synchronized L [ ] getListeners ( ) { if ( this . map == null ) { return newArray ( 0 ) ; } List < L > list = new ArrayList < > ( ) ; L [ ] listeners = this . map . get ( null ) ; if ( listeners != null ) { for ( L listener : listeners ) { list . add ( listener ) ; } } for ( Entry < String , L [ ] > entry ...
Returns all listeners in the map .
25,772
public final L [ ] getListeners ( String name ) { if ( name != null ) { L [ ] listeners = get ( name ) ; if ( listeners != null ) { return listeners . clone ( ) ; } } return newArray ( 0 ) ; }
Returns listeners that have been associated with the named property .
25,773
public final synchronized boolean hasListeners ( String name ) { if ( this . map == null ) { return false ; } L [ ] array = this . map . get ( null ) ; return ( array != null ) || ( ( name != null ) && ( null != this . map . get ( name ) ) ) ; }
Indicates whether the map contains at least one listener to be notified .
25,774
public final Set < Entry < String , L [ ] > > getEntries ( ) { return ( this . map != null ) ? this . map . entrySet ( ) : Collections . < Entry < String , L [ ] > > emptySet ( ) ; }
Returns a set of entries from the map . Each entry is a pair consisted of the property name and the corresponding list of listeners .
25,775
public int getWaitQueueLength ( Condition condition ) { if ( condition == null ) throw new NullPointerException ( ) ; if ( ! ( condition instanceof AbstractQueuedSynchronizer . ConditionObject ) ) throw new IllegalArgumentException ( "not owner" ) ; return sync . getWaitQueueLength ( ( AbstractQueuedSynchronizer . Cond...
Returns an estimate of the number of threads waiting on the given condition associated with this lock . Note that because timeouts and interrupts may occur at any time the estimate serves only as an upper bound on the actual number of waiters . This method is designed for use in monitoring of the system state not for s...
25,776
protected Collection < Thread > getWaitingThreads ( Condition condition ) { if ( condition == null ) throw new NullPointerException ( ) ; if ( ! ( condition instanceof AbstractQueuedSynchronizer . ConditionObject ) ) throw new IllegalArgumentException ( "not owner" ) ; return sync . getWaitingThreads ( ( AbstractQueued...
Returns a collection containing those threads that may be waiting on the given condition associated with this lock . Because the actual set of threads may change dynamically while constructing this result the returned collection is only a best - effort estimate . The elements of the returned collection are in no partic...
25,777
public static SimpleFormatter compileMinMaxArguments ( CharSequence pattern , int min , int max ) { StringBuilder sb = new StringBuilder ( ) ; String compiledPattern = SimpleFormatterImpl . compileToStringMinMaxArguments ( pattern , sb , min , max ) ; return new SimpleFormatter ( compiledPattern ) ; }
Creates a formatter from the pattern string . The number of arguments checked against the given limits is the highest argument number plus one not the number of occurrences of arguments .
25,778
public synchronized String findValue ( String k ) { if ( k == null ) { for ( int i = nkeys ; -- i >= 0 ; ) if ( keys [ i ] == null ) return values [ i ] ; } else for ( int i = nkeys ; -- i >= 0 ; ) { if ( k . equalsIgnoreCase ( keys [ i ] ) ) return values [ i ] ; } return null ; }
Find the value that corresponds to this key . It finds only the first occurrence of the key .
25,779
public synchronized int getKey ( String k ) { for ( int i = nkeys ; -- i >= 0 ; ) if ( ( keys [ i ] == k ) || ( k != null && k . equalsIgnoreCase ( keys [ i ] ) ) ) return i ; return - 1 ; }
return the location of the key
25,780
public boolean filterNTLMResponses ( String k ) { boolean found = false ; for ( int i = 0 ; i < nkeys ; i ++ ) { if ( k . equalsIgnoreCase ( keys [ i ] ) && values [ i ] != null && values [ i ] . length ( ) > 5 && values [ i ] . regionMatches ( true , 0 , "NTLM " , 0 , 5 ) ) { found = true ; break ; } } if ( found ) { ...
Removes bare Negotiate and Kerberos headers when an NTLM ... appears . All Performed on headers with key being k .
25,781
public synchronized void print ( PrintStream p ) { for ( int i = 0 ; i < nkeys ; i ++ ) if ( keys [ i ] != null ) { p . print ( keys [ i ] + ( values [ i ] != null ? ": " + values [ i ] : "" ) + "\r\n" ) ; } p . print ( "\r\n" ) ; p . flush ( ) ; }
Prints the key - value pairs represented by this header . Also prints the RFC required blank line at the end . Omits pairs with a null key .
25,782
public synchronized void add ( String k , String v ) { grow ( ) ; keys [ nkeys ] = k ; values [ nkeys ] = v ; nkeys ++ ; }
Adds a key value pair to the end of the header . Duplicates are allowed
25,783
public synchronized void prepend ( String k , String v ) { grow ( ) ; for ( int i = nkeys ; i > 0 ; i -- ) { keys [ i ] = keys [ i - 1 ] ; values [ i ] = values [ i - 1 ] ; } keys [ 0 ] = k ; values [ 0 ] = v ; nkeys ++ ; }
Prepends a key value pair to the beginning of the header . Duplicates are allowed
25,784
public synchronized void remove ( String k ) { if ( k == null ) { for ( int i = 0 ; i < nkeys ; i ++ ) { while ( keys [ i ] == null && i < nkeys ) { for ( int j = i ; j < nkeys - 1 ; j ++ ) { keys [ j ] = keys [ j + 1 ] ; values [ j ] = values [ j + 1 ] ; } nkeys -- ; } } } else { for ( int i = 0 ; i < nkeys ; i ++ ) {...
Remove the key from the header . If there are multiple values under the same key they are all removed . Nothing is done if the key doesn t exist . After a remove the other pairs order are not changed .
25,785
public synchronized void setIfNotSet ( String k , String v ) { if ( findValue ( k ) == null ) { add ( k , v ) ; } }
Set s the value of a key only if there is no key with that value already .
25,786
public void mergeHeader ( InputStream is ) throws java . io . IOException { if ( is == null ) return ; char s [ ] = new char [ 10 ] ; int firstc = is . read ( ) ; while ( firstc != '\n' && firstc != '\r' && firstc >= 0 ) { int len = 0 ; int keyend = - 1 ; int c ; boolean inKey = firstc > ' ' ; s [ len ++ ] = ( char ) f...
Parse and merge a MIME header from an input stream .
25,787
public static DayPeriodRules getInstance ( ULocale locale ) { String localeCode = locale . getName ( ) ; if ( localeCode . isEmpty ( ) ) { localeCode = "root" ; } Integer ruleSetNum = null ; while ( ruleSetNum == null ) { ruleSetNum = DATA . localesToRuleSetNumMap . get ( localeCode ) ; if ( ruleSetNum == null ) { loca...
Get a DayPeriodRules object given a locale . If data hasn t been loaded it will be loaded for all locales at once .
25,788
public void write ( byte [ ] b , int off , int len ) throws IOException { if ( def . finished ( ) ) { throw new IOException ( "write beyond end of stream" ) ; } if ( ( off | len | ( off + len ) | ( b . length - ( off + len ) ) ) < 0 ) { throw new IndexOutOfBoundsException ( ) ; } else if ( len == 0 ) { return ; } if ( ...
Writes an array of bytes to the compressed output stream . This method will block until all the bytes are written .
25,789
public void close ( ) throws IOException { if ( ! closed ) { finish ( ) ; if ( usesDefaultDeflater ) def . end ( ) ; out . close ( ) ; closed = true ; } }
Writes remaining compressed data to the output stream and closes the underlying stream .
25,790
protected void deflate ( ) throws IOException { int len = 0 ; while ( ( len = def . deflate ( buf , 0 , buf . length ) ) > 0 ) { out . write ( buf , 0 , len ) ; } }
Writes next block of compressed data to the output stream .
25,791
public void flush ( ) throws IOException { if ( syncFlush && ! def . finished ( ) ) { int len = 0 ; while ( ( len = def . deflate ( buf , 0 , buf . length , Deflater . SYNC_FLUSH ) ) > 0 ) { out . write ( buf , 0 , len ) ; if ( len < buf . length ) break ; } } out . flush ( ) ; }
Flushes the compressed output stream .
25,792
public Object object ( ) { if ( m_DTMXRTreeFrag . getXPathContext ( ) != null ) return new org . apache . xml . dtm . ref . DTMNodeIterator ( ( DTMIterator ) ( new org . apache . xpath . NodeSetDTM ( m_dtmRoot , m_DTMXRTreeFrag . getXPathContext ( ) . getDTMManager ( ) ) ) ) ; else return super . object ( ) ; }
Return a java object that s closest to the representation that should be handed to an extension .
25,793
public static boolean isNonCharacter ( int ch ) { if ( ( ch & NON_CHARACTER_SUFFIX_MIN_3_0_ ) == NON_CHARACTER_SUFFIX_MIN_3_0_ ) { return true ; } return ch >= NON_CHARACTER_MIN_3_1_ && ch <= NON_CHARACTER_MAX_3_1_ ; }
Determines if codepoint is a non character
25,794
static int getNullTermByteSubString ( StringBuffer str , byte [ ] array , int index ) { byte b = 1 ; while ( b != 0 ) { b = array [ index ] ; if ( b != 0 ) { str . append ( ( char ) ( b & 0x00FF ) ) ; } index ++ ; } return index ; }
Retrieves a null terminated substring from an array of bytes . Substring is a set of non - zero bytes starting from argument start to the next zero byte . If the first byte is a zero the next byte will be taken as the first byte .
25,795
static int compareNullTermByteSubString ( String str , byte [ ] array , int strindex , int aindex ) { byte b = 1 ; int length = str . length ( ) ; while ( b != 0 ) { b = array [ aindex ] ; aindex ++ ; if ( b == 0 ) { break ; } if ( strindex == length || ( str . charAt ( strindex ) != ( char ) ( b & 0xFF ) ) ) { return ...
Compares a null terminated substring from an array of bytes . Substring is a set of non - zero bytes starting from argument start to the next zero byte . if the first byte is a zero the next byte will be taken as the first byte .
25,796
static int skipNullTermByteSubString ( byte [ ] array , int index , int skipcount ) { byte b ; for ( int i = 0 ; i < skipcount ; i ++ ) { b = 1 ; while ( b != 0 ) { b = array [ index ] ; index ++ ; } } return index ; }
Skip null terminated substrings from an array of bytes . Substring is a set of non - zero bytes starting from argument start to the next zero byte . If the first byte is a zero the next byte will be taken as the first byte .
25,797
static int skipByteSubString ( byte [ ] array , int index , int length , byte skipend ) { int result ; byte b ; for ( result = 0 ; result < length ; result ++ ) { b = array [ index + result ] ; if ( b == skipend ) { result ++ ; break ; } } return result ; }
skip substrings from an array of characters where each character is a set of 2 bytes . substring is a set of non - zero bytes starting from argument start to the byte of the argument value . skips up to a max number of characters
25,798
final void nextStream ( ) throws IOException { if ( in != null ) { in . close ( ) ; } if ( e . hasMoreElements ( ) ) { in = ( InputStream ) e . nextElement ( ) ; if ( in == null ) throw new NullPointerException ( ) ; } else in = null ; }
Continues reading in the next stream if an EOF is reached .
25,799
public Object getURLStreamHandler ( String protocol ) { URLStreamHandler handler = ( URLStreamHandler ) handlers . get ( protocol ) ; if ( handler == null ) { boolean checkedWithFactory = false ; if ( factory != null ) { handler = factory . createURLStreamHandler ( protocol ) ; checkedWithFactory = true ; } if ( handle...
Returns the Stream Handler .