Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for withContentIfPresent (0.65 sec)

  1. platforms/software/resources/src/main/java/org/gradle/internal/resource/local/DefaultLocallyAvailableExternalResource.java

            return localFile.withContent(readAction);
        }
    
        @Override
        @Nullable
        public <T> ExternalResourceReadResult<T> withContentIfPresent(ContentAction<? extends T> readAction) throws ResourceException {
            return localFile.withContentIfPresent(readAction);
        }
    
        @Override
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Thu Oct 12 19:38:08 UTC 2023
    - 4.2K bytes
    - Viewed (0)
  2. platforms/software/resources/src/main/java/org/gradle/internal/resource/AbstractExternalResource.java

            ExternalResourceReadResult<T> result = withContentIfPresent(readAction);
            if (result == null) {
                throw ResourceExceptions.getMissing(getURI());
            }
            return result;
        }
    
        @Override
        public <T> ExternalResourceReadResult<T> withContent(ContentAndMetadataAction<? extends T> readAction) {
            ExternalResourceReadResult<T> result = withContentIfPresent(readAction);
            if (result == null) {
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Thu Oct 12 19:38:08 UTC 2023
    - 1.7K bytes
    - Viewed (0)
  3. platforms/software/resources/src/test/groovy/org/gradle/internal/resource/transfer/AccessorBackedExternalResourceTest.groovy

            def resource = new AccessorBackedExternalResource(name, resourceAccessor, resourceUploader, resourceLister, true)
    
            when:
            expectResourceRead(name, "1234")
            def result = resource.withContentIfPresent(action)
    
            then:
            result.result == "result 1"
            result.bytesRead == 4
            1 * action.execute(_) >> { InputStream input -> input.text; "result 1" }
            0 * _
    
            when:
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Thu Oct 12 19:38:08 UTC 2023
    - 11.2K bytes
    - Viewed (0)
  4. platforms/software/resources/src/test/groovy/org/gradle/internal/resource/local/LocalFileStandInExternalResourceTest.groovy

            def file = tmpDir.createFile("content")
            file.text = "1234"
    
            expect:
            def resource = new LocalFileStandInExternalResource(file, TestFiles.fileSystem())
            def result = resource.withContentIfPresent(new ExternalResource.ContentAndMetadataAction<String>() {
                @Override
                String execute(InputStream inputStream, ExternalResourceMetaData metaData) throws IOException {
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Thu Oct 12 19:38:08 UTC 2023
    - 14K bytes
    - Viewed (0)
  5. platforms/software/resources/src/main/java/org/gradle/internal/resource/transfer/AccessorBackedExternalResource.java

            throw new UnsupportedOperationException();
        }
    
        @Nullable
        @Override
        public <T> ExternalResourceReadResult<T> withContentIfPresent(ContentAction<? extends T> readAction) throws ResourceException {
            return accessor.withContent(name, revalidate, inputStream -> {
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Thu Oct 12 19:38:08 UTC 2023
    - 6.9K bytes
    - Viewed (0)
  6. platforms/software/dependency-management/src/test/groovy/org/gradle/internal/resource/transfer/DefaultCacheAwareExternalResourceAccessorTest.groovy

            1 * repository.resource(new ExternalResourceName("thing.sha1"), true) >> remoteSha1
            1 * remoteSha1.withContentIfPresent(_) >> null
            1 * repository.withProgressLogging() >> progressLoggingRepo
            1 * progressLoggingRepo.resource(location, true) >> remoteResource
            1 * remoteResource.withContentIfPresent(_) >> { ExternalResource.ContentAndMetadataAction a ->
                a.execute(new ByteArrayInputStream(), remoteMetaData)
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Tue Jan 02 17:19:47 UTC 2024
    - 19.1K bytes
    - Viewed (0)
  7. platforms/software/resources/src/main/java/org/gradle/internal/resource/ExternalResource.java

         *
         * @return null if the resource does not exist.
         * @throws ResourceException on failure to read the content.
         */
        @Nullable
        <T> ExternalResourceReadResult<T> withContentIfPresent(ContentAction<? extends T> readAction) throws ResourceException;
    
        /**
         * Executes the given action against the binary contents and meta-data of this resource.
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Thu Oct 12 19:38:08 UTC 2023
    - 5.7K bytes
    - Viewed (0)
  8. platforms/software/resources/src/test/groovy/org/gradle/internal/resource/transfer/UrlExternalResourceTest.groovy

        def "can read file"() {
            def file = tmpDir.createFile("content")
            file.text = "1234"
    
            expect:
            def resource = UrlExternalResource.open(file.toURI().toURL())
            resource.withContentIfPresent(new ExternalResource.ContentAndMetadataAction() {
                @Override
                String execute(InputStream inputStream, ExternalResourceMetaData metaData) throws IOException {
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Thu Oct 12 19:38:08 UTC 2023
    - 3.7K bytes
    - Viewed (0)
  9. platforms/software/resources/src/main/java/org/gradle/internal/resource/local/LocalFileStandInExternalResource.java

            } catch (IOException e) {
                throw ResourceExceptions.getFailed(getURI(), e);
            }
        }
    
        @Nullable
        @Override
        public <T> ExternalResourceReadResult<T> withContentIfPresent(ContentAndMetadataAction<? extends T> readAction) throws ResourceException {
            if (!localFile.exists()) {
                return null;
            }
            try {
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Thu Oct 12 19:38:08 UTC 2023
    - 8.5K bytes
    - Viewed (0)
  10. platforms/software/dependency-management/src/main/java/org/gradle/internal/resource/transfer/DefaultCacheAwareExternalResourceAccessor.java

                ExternalResourceName sha1Location = location.append(".sha1");
                ExternalResource resource = delegate.resource(sha1Location, revalidate);
                ExternalResourceReadResult<HashCode> result = resource.withContentIfPresent(inputStream -> {
                    String sha = IOUtils.toString(inputStream, StandardCharsets.US_ASCII);
                    // Servers may return SHA-1 with leading zeros stripped
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Tue Oct 10 21:10:11 UTC 2023
    - 11.2K bytes
    - Viewed (0)
Back to top