idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
156,300 | public static Request signV4 ( Request request , String region , String accessKey , String secretKey ) throws NoSuchAlgorithmException , InvalidKeyException { String contentSha256 = request . header ( "x-amz-content-sha256" ) ; DateTime date = DateFormat . AMZ_DATE_FORMAT . parseDateTime ( request . header ( "x-amz-dat... | Returns signed request object for given request region access key and secret key . | 202 | 14 |
156,301 | public static HttpUrl presignV4 ( Request request , String region , String accessKey , String secretKey , int expires ) throws NoSuchAlgorithmException , InvalidKeyException { String contentSha256 = "UNSIGNED-PAYLOAD" ; DateTime date = DateFormat . AMZ_DATE_FORMAT . parseDateTime ( request . header ( "x-amz-date" ) ) ;... | Returns pre - signed HttpUrl object for given request region access key secret key and expires time . | 223 | 20 |
156,302 | public static String credential ( String accessKey , DateTime date , String region ) { return accessKey + "/" + date . toString ( DateFormat . SIGNER_DATE_FORMAT ) + "/" + region + "/s3/aws4_request" ; } | Returns credential string of given access key date and region . | 58 | 11 |
156,303 | public static String postPresignV4 ( String stringToSign , String secretKey , DateTime date , String region ) throws NoSuchAlgorithmException , InvalidKeyException { Signer signer = new Signer ( null , null , date , region , null , secretKey , null ) ; signer . stringToSign = stringToSign ; signer . setSigningKey ( ) ;... | Returns pre - signed post policy string for given stringToSign secret key date and region . | 98 | 18 |
156,304 | public static byte [ ] sumHmac ( byte [ ] key , byte [ ] data ) throws NoSuchAlgorithmException , InvalidKeyException { Mac mac = Mac . getInstance ( "HmacSHA256" ) ; mac . init ( new SecretKeySpec ( key , "HmacSHA256" ) ) ; mac . update ( data ) ; return mac . doFinal ( ) ; } | Returns HMacSHA256 digest of given key and data . | 82 | 12 |
156,305 | public void setContentType ( String contentType ) throws InvalidArgumentException { if ( Strings . isNullOrEmpty ( contentType ) ) { throw new InvalidArgumentException ( "empty content type" ) ; } this . contentType = contentType ; } | Sets content type . | 55 | 5 |
156,306 | public void setContentEncoding ( String contentEncoding ) throws InvalidArgumentException { if ( Strings . isNullOrEmpty ( contentEncoding ) ) { throw new InvalidArgumentException ( "empty content encoding" ) ; } this . contentEncoding = contentEncoding ; } | Sets content encoding . | 60 | 5 |
156,307 | public void setContentRange ( long startRange , long endRange ) throws InvalidArgumentException { if ( startRange <= 0 || endRange <= 0 ) { throw new InvalidArgumentException ( "negative start/end range" ) ; } if ( startRange > endRange ) { throw new InvalidArgumentException ( "start range is higher than end range" ) ;... | Sets content range . | 97 | 5 |
156,308 | public Map < String , String > formData ( String accessKey , String secretKey , String region ) throws NoSuchAlgorithmException , InvalidKeyException , InvalidArgumentException { if ( Strings . isNullOrEmpty ( region ) ) { throw new InvalidArgumentException ( "empty region" ) ; } return makeFormData ( accessKey , secre... | Returns form data of this post policy setting the provided region . | 80 | 12 |
156,309 | public void setModified ( DateTime date ) throws InvalidArgumentException { if ( date == null ) { throw new InvalidArgumentException ( "Date cannot be empty" ) ; } copyConditions . put ( "x-amz-copy-source-if-modified-since" , date . toString ( DateFormat . HTTP_HEADER_DATE_FORMAT ) ) ; } | Set modified condition copy object modified since given time . | 84 | 10 |
156,310 | public void setMatchETag ( String etag ) throws InvalidArgumentException { if ( etag == null ) { throw new InvalidArgumentException ( "ETag cannot be empty" ) ; } copyConditions . put ( "x-amz-copy-source-if-match" , etag ) ; } | Set matching ETag condition copy object which matches the following ETag . | 68 | 14 |
156,311 | public void setMatchETagNone ( String etag ) throws InvalidArgumentException { if ( etag == null ) { throw new InvalidArgumentException ( "ETag cannot be empty" ) ; } copyConditions . put ( "x-amz-copy-source-if-none-match" , etag ) ; } | Set matching ETag none condition copy object which does not match the following ETag . | 71 | 17 |
156,312 | public void parseXml ( Reader reader ) throws IOException , XmlPullParserException { this . xmlPullParser . setInput ( reader ) ; Xml . parseElement ( this . xmlPullParser , this , this . defaultNamespaceDictionary , null ) ; } | Parses content from given reader input stream . | 57 | 10 |
156,313 | protected void parseXml ( Reader reader , XmlNamespaceDictionary namespaceDictionary ) throws IOException , XmlPullParserException { this . xmlPullParser . setInput ( reader ) ; Xml . parseElement ( this . xmlPullParser , this , namespaceDictionary , null ) ; } | Parses content from given reader input stream and namespace dictionary . | 63 | 13 |
156,314 | public int read ( ) throws IOException { if ( this . bytesRead == this . length ) { // All chunks and final additional chunk are read. // This means we have reached EOF. return - 1 ; } try { // Read a chunk from given input stream when // it is first chunk or all bytes in chunk body is read if ( this . streamBytesRead ... | read single byte from chunk body . | 309 | 7 |
156,315 | protected String adjustHost ( final String host ) { if ( host . startsWith ( HTTP_PROTOCOL ) ) { return host . replace ( HTTP_PROTOCOL , EMPTY_STRING ) ; } else if ( host . startsWith ( HTTPS_PROTOCOL ) ) { return host . replace ( HTTPS_PROTOCOL , EMPTY_STRING ) ; } return host ; } | adjusts host to needs of SocketInternetObservingStrategy | 87 | 12 |
156,316 | public static void checkNotNullOrEmpty ( String string , String message ) { if ( string == null || string . isEmpty ( ) ) { throw new IllegalArgumentException ( message ) ; } } | Validation method which checks if a string is null or empty | 42 | 12 |
156,317 | @ RequiresPermission ( Manifest . permission . ACCESS_NETWORK_STATE ) public static Observable < Connectivity > observeNetworkConnectivity ( final Context context ) { final NetworkObservingStrategy strategy ; if ( Preconditions . isAtLeastAndroidMarshmallow ( ) ) { strategy = new MarshmallowNetworkObservingStrategy ( )... | Observes network connectivity . Information about network state type and typeName are contained in observed Connectivity object . | 137 | 21 |
156,318 | @ RequiresPermission ( Manifest . permission . ACCESS_NETWORK_STATE ) public static Observable < Connectivity > observeNetworkConnectivity ( final Context context , final NetworkObservingStrategy strategy ) { Preconditions . checkNotNull ( context , "context == null" ) ; Preconditions . checkNotNull ( strategy , "strat... | Observes network connectivity . Information about network state type and typeName are contained in observed Connectivity object . Moreover allows you to define NetworkObservingStrategy . | 90 | 32 |
156,319 | @ RequiresPermission ( Manifest . permission . INTERNET ) protected static Observable < Boolean > observeInternetConnectivity ( final InternetObservingStrategy strategy , final int initialIntervalInMs , final int intervalInMs , final String host , final int port , final int timeoutInMs , final int httpResponse , final ... | Observes connectivity with the Internet in a given time interval . | 116 | 12 |
156,320 | protected static int [ ] appendUnknownNetworkTypeToTypes ( int [ ] types ) { int i = 0 ; final int [ ] extendedTypes = new int [ types . length + 1 ] ; for ( int type : types ) { extendedTypes [ i ] = type ; i ++ ; } extendedTypes [ i ] = Connectivity . UNKNOWN_TYPE ; return extendedTypes ; } | Returns network types from the input with additional unknown type what helps during connections filtering when device is being disconnected from a specific network | 79 | 24 |
156,321 | private int getAndParseHexChar ( ) throws ParseException { final char hexChar = getc ( ) ; if ( hexChar >= ' ' && hexChar <= ' ' ) { return hexChar - ' ' ; } else if ( hexChar >= ' ' && hexChar <= ' ' ) { return hexChar - ' ' + 10 ; } else if ( hexChar >= ' ' && hexChar <= ' ' ) { return hexChar - ' ' + 10 ; } else { t... | Get and parse a hexadecimal digit character . | 127 | 11 |
156,322 | private Number parseNumber ( ) throws ParseException { final int startIdx = getPosition ( ) ; if ( peekMatches ( "Infinity" ) ) { advance ( 8 ) ; return Double . POSITIVE_INFINITY ; } else if ( peekMatches ( "-Infinity" ) ) { advance ( 9 ) ; return Double . NEGATIVE_INFINITY ; } else if ( peekMatches ( "NaN" ) ) { adva... | Parses and returns Integer Long or Double type . | 634 | 11 |
156,323 | private JSONObject parseJSONObject ( ) throws ParseException { expect ( ' ' ) ; skipWhitespace ( ) ; if ( peek ( ) == ' ' ) { // Empty object next ( ) ; return new JSONObject ( Collections . < Entry < String , Object > > emptyList ( ) ) ; } final List < Entry < String , Object > > kvPairs = new ArrayList <> ( ) ; final... | Parse a JSON Object . | 314 | 6 |
156,324 | Object instantiateOrGet ( final ClassInfo annotationClassInfo , final String paramName ) { final boolean instantiate = annotationClassInfo != null ; if ( enumValue != null ) { return instantiate ? enumValue . loadClassAndReturnEnumValue ( ) : enumValue ; } else if ( classRef != null ) { return instantiate ? classRef . ... | Instantiate or get the wrapped value . | 642 | 8 |
156,325 | private Object getArrayValueClassOrName ( final ClassInfo annotationClassInfo , final String paramName , final boolean getClass ) { // Find the method in the annotation class with the same name as the annotation parameter. final MethodInfoList annotationMethodList = annotationClassInfo . methodInfo == null ? null : ann... | Get the element type of an array element . | 794 | 9 |
156,326 | public ClassGraph enableAllInfo ( ) { enableClassInfo ( ) ; enableFieldInfo ( ) ; enableMethodInfo ( ) ; enableAnnotationInfo ( ) ; enableStaticFinalFieldConstantInitializerValues ( ) ; ignoreClassVisibility ( ) ; ignoreFieldVisibility ( ) ; ignoreMethodVisibility ( ) ; return this ; } | Enables the scanning of all classes fields methods annotations and static final field constant initializer values and ignores all visibility modifiers so that both public and non - public classes fields and methods are all scanned . | 71 | 39 |
156,327 | public ClassGraph overrideClasspath ( final Iterable < ? > overrideClasspathElements ) { final String overrideClasspath = JarUtils . pathElementsToPathStr ( overrideClasspathElements ) ; if ( overrideClasspath . isEmpty ( ) ) { throw new IllegalArgumentException ( "Can't override classpath with an empty path" ) ; } ove... | Override the automatically - detected classpath with a custom path . Causes system ClassLoaders and the java . class . path system property to be ignored . Also causes modules not to be scanned . | 90 | 38 |
156,328 | public ClassGraph whitelistPackages ( final String ... packageNames ) { enableClassInfo ( ) ; for ( final String packageName : packageNames ) { final String packageNameNormalized = WhiteBlackList . normalizePackageOrClassName ( packageName ) ; if ( packageNameNormalized . startsWith ( "!" ) || packageNameNormalized . s... | Scan one or more specific packages and their sub - packages . | 330 | 12 |
156,329 | public ClassGraph whitelistPaths ( final String ... paths ) { for ( final String path : paths ) { final String pathNormalized = WhiteBlackList . normalizePath ( path ) ; // Whitelist path final String packageName = WhiteBlackList . pathToPackageName ( pathNormalized ) ; scanSpec . packageWhiteBlackList . addToWhitelist... | Scan one or more specific paths and their sub - directories or nested paths . | 258 | 15 |
156,330 | public ClassGraph whitelistPackagesNonRecursive ( final String ... packageNames ) { enableClassInfo ( ) ; for ( final String packageName : packageNames ) { final String packageNameNormalized = WhiteBlackList . normalizePackageOrClassName ( packageName ) ; if ( packageNameNormalized . contains ( "*" ) ) { throw new Ille... | Scan one or more specific packages without recursively scanning sub - packages unless they are themselves whitelisted . | 194 | 22 |
156,331 | public ClassGraph whitelistPathsNonRecursive ( final String ... paths ) { for ( final String path : paths ) { if ( path . contains ( "*" ) ) { throw new IllegalArgumentException ( "Cannot use a glob wildcard here: " + path ) ; } final String pathNormalized = WhiteBlackList . normalizePath ( path ) ; // Whitelist path, ... | Scan one or more specific paths without recursively scanning sub - directories or nested paths unless they are themselves whitelisted . | 175 | 25 |
156,332 | public ClassGraph blacklistPackages ( final String ... packageNames ) { enableClassInfo ( ) ; for ( final String packageName : packageNames ) { final String packageNameNormalized = WhiteBlackList . normalizePackageOrClassName ( packageName ) ; if ( packageNameNormalized . isEmpty ( ) ) { throw new IllegalArgumentExcept... | Prevent the scanning of one or more specific packages and their sub - packages . | 251 | 16 |
156,333 | public ClassGraph whitelistClasses ( final String ... classNames ) { enableClassInfo ( ) ; for ( final String className : classNames ) { if ( className . contains ( "*" ) ) { throw new IllegalArgumentException ( "Cannot use a glob wildcard here: " + className ) ; } final String classNameNormalized = WhiteBlackList . no... | Scan one or more specific classes without scanning other classes in the same package unless the package is itself whitelisted . | 250 | 23 |
156,334 | public ClassGraph blacklistClasses ( final String ... classNames ) { enableClassInfo ( ) ; for ( final String className : classNames ) { if ( className . contains ( "*" ) ) { throw new IllegalArgumentException ( "Cannot use a glob wildcard here: " + className ) ; } final String classNameNormalized = WhiteBlackList . no... | Specifically blacklist one or more specific classes preventing them from being scanned even if they are in a whitelisted package . | 147 | 23 |
156,335 | public ClassGraph whitelistJars ( final String ... jarLeafNames ) { for ( final String jarLeafName : jarLeafNames ) { final String leafName = JarUtils . leafName ( jarLeafName ) ; if ( ! leafName . equals ( jarLeafName ) ) { throw new IllegalArgumentException ( "Can only whitelist jars by leafname: " + jarLeafName ) ; ... | Whitelist one or more jars . This will cause only the whitelisted jars to be scanned . | 113 | 20 |
156,336 | public ClassGraph blacklistJars ( final String ... jarLeafNames ) { for ( final String jarLeafName : jarLeafNames ) { final String leafName = JarUtils . leafName ( jarLeafName ) ; if ( ! leafName . equals ( jarLeafName ) ) { throw new IllegalArgumentException ( "Can only blacklist jars by leafname: " + jarLeafName ) ; ... | Blacklist one or more jars preventing them from being scanned . | 111 | 12 |
156,337 | private void whitelistOrBlacklistLibOrExtJars ( final boolean whitelist , final String ... jarLeafNames ) { if ( jarLeafNames . length == 0 ) { // If no jar leafnames are given, whitelist or blacklist all lib or ext jars for ( final String libOrExtJar : SystemJarFinder . getJreLibOrExtJars ( ) ) { whitelistOrBlacklistL... | Add lib or ext jars to whitelist or blacklist . | 682 | 11 |
156,338 | public ClassGraph whitelistModules ( final String ... moduleNames ) { for ( final String moduleName : moduleNames ) { scanSpec . moduleWhiteBlackList . addToWhitelist ( WhiteBlackList . normalizePackageOrClassName ( moduleName ) ) ; } return this ; } | Whitelist one or more modules to scan . | 60 | 9 |
156,339 | public ClassGraph blacklistModules ( final String ... moduleNames ) { for ( final String moduleName : moduleNames ) { scanSpec . moduleWhiteBlackList . addToBlacklist ( WhiteBlackList . normalizePackageOrClassName ( moduleName ) ) ; } return this ; } | Blacklist one or more modules preventing them from being scanned . | 59 | 12 |
156,340 | public ClassGraph whitelistClasspathElementsContainingResourcePath ( final String ... resourcePaths ) { for ( final String resourcePath : resourcePaths ) { final String resourcePathNormalized = WhiteBlackList . normalizePath ( resourcePath ) ; scanSpec . classpathElementResourcePathWhiteBlackList . addToWhitelist ( res... | Whitelist classpath elements based on resource paths . Only classpath elements that contain resources with paths matching the whitelist will be scanned . | 81 | 27 |
156,341 | public ClassGraph blacklistClasspathElementsContainingResourcePath ( final String ... resourcePaths ) { for ( final String resourcePath : resourcePaths ) { final String resourcePathNormalized = WhiteBlackList . normalizePath ( resourcePath ) ; scanSpec . classpathElementResourcePathWhiteBlackList . addToBlacklist ( res... | Blacklist classpath elements based on resource paths . Classpath elements that contain resources with paths matching the blacklist will not be scanned . | 80 | 26 |
156,342 | public T acquire ( ) throws E { final T instance ; final T recycledInstance = unusedInstances . poll ( ) ; if ( recycledInstance == null ) { // Allocate a new instance -- may throw an exception of type E final T newInstance = newInstance ( ) ; if ( newInstance == null ) { throw new NullPointerException ( "Failed to all... | Acquire on object instance of type T either by reusing a previously recycled instance if possible or if there are no currently - unused instances by allocating a new instance . | 120 | 34 |
156,343 | public List < URI > getClasspathURIs ( ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } final List < URI > classpathElementOrderURIs = new ArrayList <> ( ) ; for ( final ClasspathElement classpathElement : classpathOrder ) { try { final URI uri ... | Returns an ordered list of unique classpath element and module URIs . | 146 | 14 |
156,344 | public ResourceList getAllResources ( ) { if ( allWhitelistedResourcesCached == null ) { // Index Resource objects by path final ResourceList whitelistedResourcesList = new ResourceList ( ) ; for ( final ClasspathElement classpathElt : classpathOrder ) { if ( classpathElt . whitelistedResources != null ) { whitelistedR... | Get the list of all resources . | 128 | 7 |
156,345 | public ResourceList getResourcesWithPath ( final String resourcePath ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } final ResourceList allWhitelistedResources = getAllResources ( ) ; if ( allWhitelistedResources . isEmpty ( ) ) { return Resour... | Get the list of all resources found in whitelisted packages that have the given path relative to the package root of the classpath element . May match several resources up to one per classpath element . | 153 | 40 |
156,346 | public ResourceList getResourcesWithLeafName ( final String leafName ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } final ResourceList allWhitelistedResources = getAllResources ( ) ; if ( allWhitelistedResources . isEmpty ( ) ) { return Resour... | Get the list of all resources found in whitelisted packages that have the requested leafname . | 191 | 19 |
156,347 | public ResourceList getResourcesWithExtension ( final String extension ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } final ResourceList allWhitelistedResources = getAllResources ( ) ; if ( allWhitelistedResources . isEmpty ( ) ) { return Reso... | Get the list of all resources found in whitelisted packages that have the requested filename extension . | 260 | 19 |
156,348 | public ResourceList getResourcesMatchingPattern ( final Pattern pattern ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } final ResourceList allWhitelistedResources = getAllResources ( ) ; if ( allWhitelistedResources . isEmpty ( ) ) { return Res... | Get the list of all resources found in whitelisted packages that have a path matching the requested pattern . | 162 | 21 |
156,349 | public ModuleInfoList getModuleInfo ( ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } if ( ! scanSpec . enableClassInfo ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableClassInfo() before #scan()" ) ; } return new ModuleIn... | Get all modules found during the scan . | 96 | 8 |
156,350 | public PackageInfoList getPackageInfo ( ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } if ( ! scanSpec . enableClassInfo ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableClassInfo() before #scan()" ) ; } return new Packag... | Get all packages found during the scan . | 96 | 8 |
156,351 | public ClassInfoList getAllClasses ( ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } if ( ! scanSpec . enableClassInfo ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableClassInfo() before #scan()" ) ; } return ClassInfo . g... | Get all classes interfaces and annotations found during the scan . | 103 | 11 |
156,352 | public ClassInfoList getSubclasses ( final String superclassName ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } if ( ! scanSpec . enableClassInfo ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableClassInfo() before #scan()... | Get all subclasses of the named superclass . | 171 | 10 |
156,353 | public ClassInfoList getSuperclasses ( final String subclassName ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } if ( ! scanSpec . enableClassInfo ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableClassInfo() before #scan()... | Get superclasses of the named subclass . | 122 | 8 |
156,354 | public ClassInfoList getClassesWithMethodAnnotation ( final String methodAnnotationName ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } if ( ! scanSpec . enableClassInfo || ! scanSpec . enableMethodInfo || ! scanSpec . enableAnnotationInfo ) { ... | Get classes that have a method with an annotation of the named type . | 169 | 14 |
156,355 | public ClassInfoList getClassesWithMethodParameterAnnotation ( final String methodParameterAnnotationName ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } if ( ! scanSpec . enableClassInfo || ! scanSpec . enableMethodInfo || ! scanSpec . enableA... | Get classes that have a method with a parameter that is annotated with an annotation of the named type . | 173 | 21 |
156,356 | public ClassInfoList getClassesWithFieldAnnotation ( final String fieldAnnotationName ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } if ( ! scanSpec . enableClassInfo || ! scanSpec . enableFieldInfo || ! scanSpec . enableAnnotationInfo ) { thr... | Get classes that have a field with an annotation of the named type . | 169 | 14 |
156,357 | public ClassInfoList getInterfaces ( final String className ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } if ( ! scanSpec . enableClassInfo ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableClassInfo() before #scan()" ) ;... | Get all interfaces implemented by the named class or by one of its superclasses if this is a standard class or the superinterfaces extended by this interface if this is an interface . | 125 | 36 |
156,358 | public ClassInfoList getClassesWithAnnotation ( final String annotationName ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } if ( ! scanSpec . enableClassInfo || ! scanSpec . enableAnnotationInfo ) { throw new IllegalArgumentException ( "Please ... | Get classes with the named class annotation or meta - annotation . | 147 | 12 |
156,359 | public static ScanResult fromJSON ( final String json ) { final Matcher matcher = Pattern . compile ( "\\{[\\n\\r ]*\"format\"[ ]?:[ ]?\"([^\"]+)\"" ) . matcher ( json ) ; if ( ! matcher . find ( ) ) { throw new IllegalArgumentException ( "JSON is not in correct format" ) ; } if ( ! CURRENT_SERIALIZATION_FORMAT . equal... | Deserialize a ScanResult from previously - serialized JSON . | 718 | 13 |
156,360 | public String toJSON ( final int indentWidth ) { if ( closed . get ( ) ) { throw new IllegalArgumentException ( "Cannot use a ScanResult after it has been closed" ) ; } if ( ! scanSpec . enableClassInfo ) { throw new IllegalArgumentException ( "Please call ClassGraph#enableClassInfo() before #scan()" ) ; } final List <... | Serialize a ScanResult to JSON . | 259 | 8 |
156,361 | Type resolveTypeVariables ( final Type type ) { if ( type instanceof Class < ? > ) { // Arrays and non-generic classes have no type variables return type ; } else if ( type instanceof ParameterizedType ) { // Recursively resolve parameterized types final ParameterizedType parameterizedType = ( ParameterizedType ) type ... | Resolve the type variables in a type using a type variable resolution list producing a resolved type . | 832 | 19 |
156,362 | private static void assignObjectIds ( final Object jsonVal , final Map < ReferenceEqualityKey < Object > , JSONObject > objToJSONVal , final ClassFieldCache classFieldCache , final Map < ReferenceEqualityKey < JSONReference > , CharSequence > jsonReferenceToId , final AtomicInteger objId , final boolean onlySerializePu... | Create a unique id for each referenced JSON object . | 719 | 10 |
156,363 | static void jsonValToJSONString ( final Object jsonVal , final Map < ReferenceEqualityKey < JSONReference > , CharSequence > jsonReferenceToId , final boolean includeNullValuedFields , final int depth , final int indentWidth , final StringBuilder buf ) { if ( jsonVal == null ) { buf . append ( "null" ) ; } else if ( js... | Serialize a JSON object array or value . | 393 | 9 |
156,364 | private void scheduleScanningIfExternalClass ( final String className , final String relationship ) { // Don't scan Object if ( className != null && ! className . equals ( "java.lang.Object" ) // Only schedule each external class once for scanning, across all threads && classNamesScheduledForScanning . add ( className ... | Extend scanning to a superclass interface or annotation . | 502 | 11 |
156,365 | private void extendScanningUpwards ( ) { // Check superclass if ( superclassName != null ) { scheduleScanningIfExternalClass ( superclassName , "superclass" ) ; } // Check implemented interfaces if ( implementedInterfaces != null ) { for ( final String interfaceName : implementedInterfaces ) { scheduleScanningIfExterna... | Check if scanning needs to be extended upwards to an external superclass interface or annotation . | 405 | 17 |
156,366 | private String intern ( final String str ) { if ( str == null ) { return null ; } final String interned = stringInternMap . putIfAbsent ( str , str ) ; if ( interned != null ) { return interned ; } return str ; } | Intern a string . | 56 | 4 |
156,367 | private int getConstantPoolStringOffset ( final int cpIdx , final int subFieldIdx ) throws ClassfileFormatException { if ( cpIdx < 1 || cpIdx >= cpCount ) { throw new ClassfileFormatException ( "Constant pool index " + cpIdx + ", should be in range [1, " + ( cpCount - 1 ) + "] -- cannot continue reading class. " + "Ple... | Get the byte offset within the buffer of a string from the constant pool or 0 for a null string . | 811 | 21 |
156,368 | private String getConstantPoolString ( final int cpIdx , final int subFieldIdx ) throws ClassfileFormatException , IOException { final int constantPoolStringOffset = getConstantPoolStringOffset ( cpIdx , subFieldIdx ) ; return constantPoolStringOffset == 0 ? null : intern ( inputStreamOrByteBuffer . readString ( consta... | Get a string from the constant pool . | 103 | 8 |
156,369 | private byte getConstantPoolStringFirstByte ( final int cpIdx ) throws ClassfileFormatException , IOException { final int constantPoolStringOffset = getConstantPoolStringOffset ( cpIdx , /* subFieldIdx = */ 0 ) ; if ( constantPoolStringOffset == 0 ) { return ' ' ; } final int utfLen = inputStreamOrByteBuffer . readUnsi... | Get the first UTF8 byte of a string in the constant pool or \ 0 if the string is null or empty . | 123 | 24 |
156,370 | private boolean constantPoolStringEquals ( final int cpIdx , final String asciiString ) throws ClassfileFormatException , IOException { final int strOffset = getConstantPoolStringOffset ( cpIdx , /* subFieldIdx = */ 0 ) ; if ( strOffset == 0 ) { return asciiString == null ; } else if ( asciiString == null ) { return fa... | Compare a string in the constant pool with a given ASCII string without constructing the constant pool String object . | 206 | 20 |
156,371 | private int cpReadUnsignedShort ( final int cpIdx ) throws IOException { if ( cpIdx < 1 || cpIdx >= cpCount ) { throw new ClassfileFormatException ( "Constant pool index " + cpIdx + ", should be in range [1, " + ( cpCount - 1 ) + "] -- cannot continue reading class. " + "Please report this at https://github.com/classgr... | Read an unsigned short from the constant pool . | 123 | 9 |
156,372 | private int cpReadInt ( final int cpIdx ) throws IOException { if ( cpIdx < 1 || cpIdx >= cpCount ) { throw new ClassfileFormatException ( "Constant pool index " + cpIdx + ", should be in range [1, " + ( cpCount - 1 ) + "] -- cannot continue reading class. " + "Please report this at https://github.com/classgraph/classg... | Read an int from the constant pool . | 119 | 8 |
156,373 | private long cpReadLong ( final int cpIdx ) throws IOException { if ( cpIdx < 1 || cpIdx >= cpCount ) { throw new ClassfileFormatException ( "Constant pool index " + cpIdx + ", should be in range [1, " + ( cpCount - 1 ) + "] -- cannot continue reading class. " + "Please report this at https://github.com/classgraph/clas... | Read a long from the constant pool . | 119 | 8 |
156,374 | private Object getFieldConstantPoolValue ( final int tag , final char fieldTypeDescriptorFirstChar , final int cpIdx ) throws ClassfileFormatException , IOException { switch ( tag ) { case 1 : // Modified UTF8 case 7 : // Class -- N.B. Unused? Class references do not seem to actually be stored as constant initalizers c... | Get a field constant from the constant pool . | 419 | 9 |
156,375 | private AnnotationInfo readAnnotation ( ) throws IOException { // Lcom/xyz/Annotation; -> Lcom.xyz.Annotation; final String annotationClassName = getConstantPoolClassDescriptor ( inputStreamOrByteBuffer . readUnsignedShort ( ) ) ; final int numElementValuePairs = inputStreamOrByteBuffer . readUnsignedShort ( ) ; Annota... | Read annotation entry from classfile . | 218 | 7 |
156,376 | private Object readAnnotationElementValue ( ) throws IOException { final int tag = ( char ) inputStreamOrByteBuffer . readUnsignedByte ( ) ; switch ( tag ) { case ' ' : return ( byte ) cpReadInt ( inputStreamOrByteBuffer . readUnsignedShort ( ) ) ; case ' ' : return ( char ) cpReadInt ( inputStreamOrByteBuffer . readUn... | Read annotation element value from classfile . | 608 | 8 |
156,377 | private void readBasicClassInfo ( ) throws IOException , ClassfileFormatException , SkipClassException { // Modifier flags classModifiers = inputStreamOrByteBuffer . readUnsignedShort ( ) ; isInterface = ( classModifiers & 0x0200 ) != 0 ; isAnnotation = ( classModifiers & 0x2000 ) != 0 ; // The fully-qualified class na... | Read basic class information . | 562 | 5 |
156,378 | private void readInterfaces ( ) throws IOException { // Interfaces final int interfaceCount = inputStreamOrByteBuffer . readUnsignedShort ( ) ; for ( int i = 0 ; i < interfaceCount ; i ++ ) { final String interfaceName = getConstantPoolClassName ( inputStreamOrByteBuffer . readUnsignedShort ( ) ) ; if ( implementedInte... | Read the class interfaces . | 108 | 5 |
156,379 | private void appendPath ( final StringBuilder buf ) { if ( parentZipFileSlice != null ) { parentZipFileSlice . appendPath ( buf ) ; if ( buf . length ( ) > 0 ) { buf . append ( "!/" ) ; } } buf . append ( pathWithinParentZipFileSlice ) ; } | Recursively append the path in top down ancestral order . | 70 | 12 |
156,380 | public void filterClasspathElements ( final ClasspathElementFilter classpathElementFilter ) { if ( this . classpathElementFilters == null ) { this . classpathElementFilters = new ArrayList <> ( 2 ) ; } this . classpathElementFilters . add ( classpathElementFilter ) ; } | Add a classpath element filter . The provided ClasspathElementFilter should return true if the path string passed to it is a path you want to scan . | 67 | 31 |
156,381 | private static boolean isModuleLayer ( final Object moduleLayer ) { if ( moduleLayer == null ) { throw new IllegalArgumentException ( "ModuleLayer references must not be null" ) ; } for ( Class < ? > currClass = moduleLayer . getClass ( ) ; currClass != null ; currClass = currClass . getSuperclass ( ) ) { if ( currClas... | Return true if the argument is a ModuleLayer or a subclass of ModuleLayer . | 112 | 16 |
156,382 | public void addModuleLayer ( final Object moduleLayer ) { if ( ! isModuleLayer ( moduleLayer ) ) { throw new IllegalArgumentException ( "moduleLayer must be of type java.lang.ModuleLayer" ) ; } if ( this . addedModuleLayers == null ) { this . addedModuleLayers = new ArrayList <> ( ) ; } this . addedModuleLayers . add (... | Add a ModuleLayer to the list of ModuleLayers to scan . Use this method if you define your own ModuleLayer but the scanning code is not running within that custom ModuleLayer . | 90 | 37 |
156,383 | public void log ( final LogNode log ) { if ( log != null ) { final LogNode scanSpecLog = log . log ( "ScanSpec:" ) ; for ( final Field field : ScanSpec . class . getDeclaredFields ( ) ) { try { scanSpecLog . log ( field . getName ( ) + ": " + field . get ( this ) ) ; } catch ( final ReflectiveOperationException e ) { /... | Write to log . | 98 | 4 |
156,384 | private static Class < ? > [ ] getCallStackViaSecurityManager ( final LogNode log ) { try { return new CallerResolver ( ) . getClassContext ( ) ; } catch ( final SecurityException e ) { // Creating a SecurityManager can fail if the current SecurityManager does not allow // RuntimePermission("createSecurityManager") if ... | Get the call stack via the SecurityManager API . | 103 | 10 |
156,385 | static Class < ? > [ ] getClassContext ( final LogNode log ) { // For JRE 9+, use StackWalker to get call stack. // N.B. need to work around StackWalker bug fixed in JDK 13, and backported to 12.0.2 and 11.0.4 // (probably introduced in JDK 9, when StackWalker was introduced): // https://github.com/classgraph/classgrap... | Get the class context . | 765 | 5 |
156,386 | public List < V > values ( ) throws InterruptedException { final List < V > entries = new ArrayList <> ( map . size ( ) ) ; for ( final Entry < K , SingletonHolder < V > > ent : map . entrySet ( ) ) { final V entryValue = ent . getValue ( ) . get ( ) ; if ( entryValue != null ) { entries . add ( entryValue ) ; } } retu... | Get all valid singleton values in the map . | 96 | 10 |
156,387 | protected void checkResourcePathWhiteBlackList ( final String relativePath , final LogNode log ) { // Whitelist/blacklist classpath elements based on file resource paths if ( ! scanSpec . classpathElementResourcePathWhiteBlackList . whitelistAndBlacklistAreEmpty ( ) ) { if ( scanSpec . classpathElementResourcePathWhite... | Check relativePath against classpathElementResourcePathWhiteBlackList . | 197 | 13 |
156,388 | protected void addWhitelistedResource ( final Resource resource , final ScanSpecPathMatch parentMatchStatus , final LogNode log ) { final String path = resource . getPath ( ) ; final boolean isClassFile = FileUtils . isClassfile ( path ) ; boolean isWhitelisted = false ; if ( isClassFile ) { // Check classfile scanning... | Add a resource discovered during the scan . | 493 | 8 |
156,389 | public URI getLocation ( ) { if ( locationURI == null ) { locationURI = moduleRef != null ? moduleRef . getLocation ( ) : null ; if ( locationURI == null ) { locationURI = classpathElement . getURI ( ) ; } } return locationURI ; } | The module location or null for modules whose location is unknown . | 60 | 12 |
156,390 | void addAnnotations ( final AnnotationInfoList moduleAnnotations ) { // Currently only class annotations are used in the module-info.class file if ( moduleAnnotations != null && ! moduleAnnotations . isEmpty ( ) ) { if ( this . annotationInfo == null ) { this . annotationInfo = new AnnotationInfoList ( moduleAnnotation... | Add annotations found in a module descriptor classfile . | 94 | 10 |
156,391 | static TypeVariableSignature parse ( final Parser parser , final String definingClassName ) throws ParseException { final char peek = parser . peek ( ) ; if ( peek == ' ' ) { parser . next ( ) ; if ( ! TypeUtils . getIdentifierToken ( parser ) ) { throw new ParseException ( parser , "Could not parse type variable signa... | Parse a TypeVariableSignature . | 238 | 8 |
156,392 | private void logJavaInfo ( ) { log ( "Operating system: " + VersionFinder . getProperty ( "os.name" ) + " " + VersionFinder . getProperty ( "os.version" ) + " " + VersionFinder . getProperty ( "os.arch" ) ) ; log ( "Java version: " + VersionFinder . getProperty ( "java.version" ) + " / " + VersionFinder . getProperty (... | Log the Java version and the JRE paths that were found . | 213 | 13 |
156,393 | private void appendLine ( final String timeStampStr , final int indentLevel , final String line , final StringBuilder buf ) { buf . append ( timeStampStr ) ; buf . append ( ' ' ) ; buf . append ( ClassGraph . class . getSimpleName ( ) ) ; buf . append ( ' ' ) ; final int numDashes = 2 * ( indentLevel - 1 ) ; for ( int ... | Append a line to the log output indenting this log entry according to tree structure . | 144 | 18 |
156,394 | private LogNode addChild ( final String sortKey , final String msg , final long elapsedTimeNanos , final Throwable exception ) { final String newSortKey = sortKeyPrefix + "\t" + ( sortKey == null ? "" : sortKey ) + "\t" + String . format ( "%09d" , sortKeyUniqueSuffix . getAndIncrement ( ) ) ; final LogNode newChild = ... | Add a child log node . | 171 | 6 |
156,395 | private LogNode addChild ( final String sortKey , final String msg , final long elapsedTimeNanos ) { return addChild ( sortKey , msg , elapsedTimeNanos , null ) ; } | Add a child log node for a message . | 41 | 9 |
156,396 | public LogNode log ( final String sortKey , final String msg , final long elapsedTimeNanos ) { return addChild ( sortKey , msg , elapsedTimeNanos ) ; } | Add a log entry with sort key for deterministic ordering . | 38 | 12 |
156,397 | public LogNode log ( final String msg , final Throwable e ) { return addChild ( "" , msg , - 1L ) . addChild ( e ) ; } | Add a log entry . | 35 | 5 |
156,398 | public LogNode log ( final Collection < String > msgs ) { LogNode last = null ; for ( final String m : msgs ) { last = log ( m ) ; } return last ; } | Add a series of log entries . Returns the last LogNode created . | 42 | 14 |
156,399 | public void flush ( ) { if ( parent != null ) { throw new IllegalArgumentException ( "Only flush the toplevel LogNode" ) ; } if ( ! children . isEmpty ( ) ) { final String logOutput = this . toString ( ) ; this . children . clear ( ) ; log . info ( logOutput ) ; } } | Flush out the log to stderr and clear the log contents . Only call this on the toplevel log node when threads do not have access to references of internal log nodes so that they cannot add more log entries inside the tree otherwise log entries may be lost . | 74 | 55 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.