idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
156,600
private void completeMultipart ( String bucketName , String objectName , String uploadId , Part [ ] parts ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalExcep...
Executes complete multipart upload of given bucket name object name upload ID and parts .
156,601
private void abortMultipartUpload ( String bucketName , String objectName , String uploadId ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { Map < S...
Aborts multipart upload of given bucket name object name and upload ID .
156,602
public void removeIncompleteUpload ( String bucketName , String objectName ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { for ( Result < Upload > ...
Removes incomplete multipart upload of given object .
156,603
public void listenBucketNotification ( String bucketName , String prefix , String suffix , String [ ] events , BucketEventListener eventCallback ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException ,...
Listen to bucket notifications .
156,604
private static int [ ] calculateMultipartSize ( long size ) throws InvalidArgumentException { if ( size > MAX_OBJECT_SIZE ) { throw new InvalidArgumentException ( "size " + size + " is greater than allowed size 5TiB" ) ; } double partSize = Math . ceil ( ( double ) size / MAX_MULTIPART_COUNT ) ; partSize = Math . ceil ...
Calculates multipart size of given size and returns three element array contains part size part count and last part size .
156,605
private int getAvailableSize ( Object inputStream , int expectedReadSize ) throws IOException , InternalException { RandomAccessFile file = null ; BufferedInputStream stream = null ; if ( inputStream instanceof RandomAccessFile ) { file = ( RandomAccessFile ) inputStream ; } else if ( inputStream instanceof BufferedInp...
Return available size of given input stream up to given expected read size . If less data is available than expected read size it returns how much data available to read .
156,606
public void traceOn ( OutputStream traceStream ) { if ( traceStream == null ) { throw new NullPointerException ( ) ; } else { this . traceStream = new PrintWriter ( new OutputStreamWriter ( traceStream , StandardCharsets . UTF_8 ) , true ) ; } }
Enables HTTP call tracing and written to traceStream .
156,607
public static void set ( Headers headers , Object destination ) { Field [ ] publicFields ; Field [ ] privateFields ; Field [ ] fields ; Class < ? > cls = destination . getClass ( ) ; publicFields = cls . getFields ( ) ; privateFields = cls . getDeclaredFields ( ) ; fields = new Field [ publicFields . length + privateFi...
Sets destination object from Headers object .
156,608
public static String encode ( String str ) { if ( str == null ) { return "" ; } return ESCAPER . escape ( str ) . replaceAll ( "\\!" , "%21" ) . replaceAll ( "\\$" , "%24" ) . replaceAll ( "\\&" , "%26" ) . replaceAll ( "\\'" , "%27" ) . replaceAll ( "\\(" , "%28" ) . replaceAll ( "\\)" , "%29" ) . replaceAll ( "\\*" ,...
Returns S3 encoded string .
156,609
public static String getChunkSignature ( String chunkSha256 , DateTime date , String region , String secretKey , String prevSignature ) throws NoSuchAlgorithmException , InvalidKeyException { Signer signer = new Signer ( null , chunkSha256 , date , region , null , secretKey , prevSignature ) ; signer . setScope ( ) ; s...
Returns chunk signature calculated using given arguments .
156,610
public static String getChunkSeedSignature ( Request request , String region , String secretKey ) throws NoSuchAlgorithmException , InvalidKeyException { String contentSha256 = request . header ( "x-amz-content-sha256" ) ; DateTime date = DateFormat . AMZ_DATE_FORMAT . parseDateTime ( request . header ( "x-amz-date" ) ...
Returns seed signature for given request .
156,611
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 .
156,612
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 .
156,613
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 .
156,614
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 .
156,615
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 .
156,616
public void setContentType ( String contentType ) throws InvalidArgumentException { if ( Strings . isNullOrEmpty ( contentType ) ) { throw new InvalidArgumentException ( "empty content type" ) ; } this . contentType = contentType ; }
Sets content type .
156,617
public void setContentEncoding ( String contentEncoding ) throws InvalidArgumentException { if ( Strings . isNullOrEmpty ( contentEncoding ) ) { throw new InvalidArgumentException ( "empty content encoding" ) ; } this . contentEncoding = contentEncoding ; }
Sets content encoding .
156,618
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 .
156,619
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 .
156,620
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 .
156,621
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 .
156,622
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 .
156,623
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 .
156,624
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 .
156,625
public int read ( ) throws IOException { if ( this . bytesRead == this . length ) { return - 1 ; } try { if ( this . streamBytesRead == 0 || this . chunkPos == this . chunkBody . length ) { if ( this . streamBytesRead != this . streamSize ) { int chunkSize = CHUNK_SIZE ; if ( this . streamBytesRead + chunkSize > this ....
read single byte from chunk body .
156,626
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
156,627
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
156,628
@ 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 .
156,629
@ 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 .
156,630
@ 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 .
156,631
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
156,632
private int getAndParseHexChar ( ) throws ParseException { final char hexChar = getc ( ) ; if ( hexChar >= '0' && hexChar <= '9' ) { return hexChar - '0' ; } else if ( hexChar >= 'a' && hexChar <= 'f' ) { return hexChar - 'a' + 10 ; } else if ( hexChar >= 'A' && hexChar <= 'F' ) { return hexChar - 'A' + 10 ; } else { t...
Get and parse a hexadecimal digit character .
156,633
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 .
156,634
private JSONObject parseJSONObject ( ) throws ParseException { expect ( '{' ) ; skipWhitespace ( ) ; if ( peek ( ) == '}' ) { next ( ) ; return new JSONObject ( Collections . < Entry < String , Object > > emptyList ( ) ) ; } final List < Entry < String , Object > > kvPairs = new ArrayList < > ( ) ; final JSONObject jso...
Parse a JSON Object .
156,635
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 .
156,636
private Object getArrayValueClassOrName ( final ClassInfo annotationClassInfo , final String paramName , final boolean getClass ) { final MethodInfoList annotationMethodList = annotationClassInfo . methodInfo == null ? null : annotationClassInfo . methodInfo . get ( paramName ) ; if ( annotationMethodList != null && an...
Get the element type of an array element .
156,637
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 .
156,638
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 .
156,639
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 .
156,640
public ClassGraph whitelistPaths ( final String ... paths ) { for ( final String path : paths ) { final String pathNormalized = WhiteBlackList . normalizePath ( path ) ; final String packageName = WhiteBlackList . pathToPackageName ( pathNormalized ) ; scanSpec . packageWhiteBlackList . addToWhitelist ( packageName ) ;...
Scan one or more specific paths and their sub - directories or nested paths .
156,641
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 .
156,642
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 ) ; scanSpec . packageW...
Scan one or more specific paths without recursively scanning sub - directories or nested paths unless they are themselves whitelisted .
156,643
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 .
156,644
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 .
156,645
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 .
156,646
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 .
156,647
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 .
156,648
private void whitelistOrBlacklistLibOrExtJars ( final boolean whitelist , final String ... jarLeafNames ) { if ( jarLeafNames . length == 0 ) { for ( final String libOrExtJar : SystemJarFinder . getJreLibOrExtJars ( ) ) { whitelistOrBlacklistLibOrExtJars ( whitelist , JarUtils . leafName ( libOrExtJar ) ) ; } } else { ...
Add lib or ext jars to whitelist or blacklist .
156,649
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 .
156,650
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 .
156,651
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 .
156,652
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 .
156,653
public T acquire ( ) throws E { final T instance ; final T recycledInstance = unusedInstances . poll ( ) ; if ( recycledInstance == null ) { final T newInstance = newInstance ( ) ; if ( newInstance == null ) { throw new NullPointerException ( "Failed to allocate a new recyclable instance" ) ; } instance = newInstance ;...
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 .
156,654
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 .
156,655
public ResourceList getAllResources ( ) { if ( allWhitelistedResourcesCached == null ) { final ResourceList whitelistedResourcesList = new ResourceList ( ) ; for ( final ClasspathElement classpathElt : classpathOrder ) { if ( classpathElt . whitelistedResources != null ) { whitelistedResourcesList . addAll ( classpathE...
Get the list of all resources .
156,656
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 .
156,657
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 .
156,658
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 .
156,659
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 .
156,660
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 .
156,661
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 .
156,662
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 .
156,663
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 .
156,664
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 .
156,665
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 .
156,666
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 .
156,667
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 .
156,668
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 .
156,669
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 .
156,670
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 .
156,671
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 .
156,672
Type resolveTypeVariables ( final Type type ) { if ( type instanceof Class < ? > ) { return type ; } else if ( type instanceof ParameterizedType ) { final ParameterizedType parameterizedType = ( ParameterizedType ) type ; final Type [ ] typeArgs = parameterizedType . getActualTypeArguments ( ) ; Type [ ] typeArgsResolv...
Resolve the type variables in a type using a type variable resolution list producing a resolved type .
156,673
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 .
156,674
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 .
156,675
private void scheduleScanningIfExternalClass ( final String className , final String relationship ) { if ( className != null && ! className . equals ( "java.lang.Object" ) && classNamesScheduledForScanning . add ( className ) ) { final String classfilePath = JarUtils . classNameToClassfilePath ( className ) ; Resource ...
Extend scanning to a superclass interface or annotation .
156,676
private void extendScanningUpwards ( ) { if ( superclassName != null ) { scheduleScanningIfExternalClass ( superclassName , "superclass" ) ; } if ( implementedInterfaces != null ) { for ( final String interfaceName : implementedInterfaces ) { scheduleScanningIfExternalClass ( interfaceName , "interface" ) ; } } if ( cl...
Check if scanning needs to be extended upwards to an external superclass interface or annotation .
156,677
void link ( final Map < String , ClassInfo > classNameToClassInfo , final Map < String , PackageInfo > packageNameToPackageInfo , final Map < String , ModuleInfo > moduleNameToModuleInfo ) { boolean isModuleDescriptor = false ; boolean isPackageDescriptor = false ; ClassInfo classInfo = null ; if ( className . equals (...
Link classes . Not threadsafe should be run in a single - threaded context .
156,678
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 .
156,679
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 .
156,680
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 .
156,681
private byte getConstantPoolStringFirstByte ( final int cpIdx ) throws ClassfileFormatException , IOException { final int constantPoolStringOffset = getConstantPoolStringOffset ( cpIdx , 0 ) ; if ( constantPoolStringOffset == 0 ) { return '\0' ; } final int utfLen = inputStreamOrByteBuffer . readUnsignedShort ( constan...
Get the first UTF8 byte of a string in the constant pool or \ 0 if the string is null or empty .
156,682
private boolean constantPoolStringEquals ( final int cpIdx , final String asciiString ) throws ClassfileFormatException , IOException { final int strOffset = getConstantPoolStringOffset ( cpIdx , 0 ) ; if ( strOffset == 0 ) { return asciiString == null ; } else if ( asciiString == null ) { return false ; } final int st...
Compare a string in the constant pool with a given ASCII string without constructing the constant pool String object .
156,683
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 .
156,684
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 .
156,685
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 .
156,686
private Object getFieldConstantPoolValue ( final int tag , final char fieldTypeDescriptorFirstChar , final int cpIdx ) throws ClassfileFormatException , IOException { switch ( tag ) { case 1 : case 7 : case 8 : return getConstantPoolString ( cpIdx ) ; case 3 : final int intVal = cpReadInt ( cpIdx ) ; switch ( fieldType...
Get a field constant from the constant pool .
156,687
private AnnotationInfo readAnnotation ( ) throws IOException { final String annotationClassName = getConstantPoolClassDescriptor ( inputStreamOrByteBuffer . readUnsignedShort ( ) ) ; final int numElementValuePairs = inputStreamOrByteBuffer . readUnsignedShort ( ) ; AnnotationParameterValueList paramVals = null ; if ( n...
Read annotation entry from classfile .
156,688
private Object readAnnotationElementValue ( ) throws IOException { final int tag = ( char ) inputStreamOrByteBuffer . readUnsignedByte ( ) ; switch ( tag ) { case 'B' : return ( byte ) cpReadInt ( inputStreamOrByteBuffer . readUnsignedShort ( ) ) ; case 'C' : return ( char ) cpReadInt ( inputStreamOrByteBuffer . readUn...
Read annotation element value from classfile .
156,689
private void readBasicClassInfo ( ) throws IOException , ClassfileFormatException , SkipClassException { classModifiers = inputStreamOrByteBuffer . readUnsignedShort ( ) ; isInterface = ( classModifiers & 0x0200 ) != 0 ; isAnnotation = ( classModifiers & 0x2000 ) != 0 ; final String classNamePath = getConstantPoolStrin...
Read basic class information .
156,690
private void readInterfaces ( ) throws IOException { final int interfaceCount = inputStreamOrByteBuffer . readUnsignedShort ( ) ; for ( int i = 0 ; i < interfaceCount ; i ++ ) { final String interfaceName = getConstantPoolClassName ( inputStreamOrByteBuffer . readUnsignedShort ( ) ) ; if ( implementedInterfaces == null...
Read the class interfaces .
156,691
private void readClassAttributes ( ) throws IOException , ClassfileFormatException { final int attributesCount = inputStreamOrByteBuffer . readUnsignedShort ( ) ; for ( int i = 0 ; i < attributesCount ; i ++ ) { final int attributeNameCpIdx = inputStreamOrByteBuffer . readUnsignedShort ( ) ; final int attributeLength =...
Read class attributes .
156,692
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 .
156,693
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 .
156,694
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 .
156,695
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 .
156,696
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 .
156,697
private static Class < ? > [ ] getCallStackViaSecurityManager ( final LogNode log ) { try { return new CallerResolver ( ) . getClassContext ( ) ; } catch ( final SecurityException e ) { if ( log != null ) { log . log ( "Exception while trying to obtain call stack via SecurityManager" , e ) ; } return null ; } }
Get the call stack via the SecurityManager API .
156,698
static Class < ? > [ ] getClassContext ( final LogNode log ) { Class < ? > [ ] stackClasses = null ; if ( ( VersionFinder . JAVA_MAJOR_VERSION == 11 && ( VersionFinder . JAVA_MINOR_VERSION >= 1 || VersionFinder . JAVA_SUB_VERSION >= 4 ) && ! VersionFinder . JAVA_IS_EA_VERSION ) || ( VersionFinder . JAVA_MAJOR_VERSION =...
Get the class context .
156,699
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 ) ; } } ret...
Get all valid singleton values in the map .