Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for IoFunction (0.15 sec)

  1. platforms/core-runtime/functional/src/main/java/org/gradle/internal/io/IoFunction.java

     */
    @FunctionalInterface
    public interface IoFunction<T, R> {
        @Nullable
        R apply(@Nullable T t) throws IOException;
    
        /**
         * Wraps an {@link IOException}-throwing {@link IoFunction} into a regular {@link Function}.
         *
         * Any {@code IOException}s are rethrown as {@link UncheckedIOException}.
         */
        static <T, R> Function<T, R> wrap(IoFunction<T, R> function) {
            return t -> {
                try {
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Fri Sep 22 08:22:02 UTC 2023
    - 1.4K bytes
    - Viewed (0)
  2. platforms/core-runtime/files/src/main/java/org/gradle/api/internal/file/archive/ZipEntry.java

         * The {@link InputStream} passed to the {@link IoFunction#apply(Object)} will
         * be closed right after the action's return.
         *
         * This method or {@link #getContent()} may or may not support being called more than once per entry.
         * Use {@link #canReopen()} to determine if more than one call is supported.
         */
        <T> T withInputStream(IoFunction<InputStream, T> action) throws IOException;
    
        /**
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Tue May 28 12:11:00 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  3. platforms/jvm/normalization-java/src/main/java/org/gradle/api/internal/changedetection/state/AbiExtractingClasspathResourceHasher.java

                @Override
                HashCode handle(RegularFileSnapshot fileSnapshot, IoFunction<RegularFileSnapshot, HashCode> function) throws IOException {
                    return function.apply(fileSnapshot);
                }
    
                @Nullable
                @Override
                HashCode handle(ZipEntryContent zipEntry, IoFunction<ZipEntryContent, HashCode> function) throws IOException {
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Thu Sep 28 15:09:49 UTC 2023
    - 6.4K bytes
    - Viewed (0)
  4. platforms/jvm/normalization-java/src/main/java/org/gradle/api/internal/changedetection/state/LineEndingNormalizingResourceHasher.java

            return Optional.of(snapshotContext)
                .flatMap(IoFunction.wrap(this::hashContent));
        }
    
        @Override
        Optional<HashCode> tryHash(ZipEntryContext zipEntryContext) {
            return Optional.of(zipEntryContext)
                .flatMap(IoFunction.wrap(this::hashContent));
        }
    
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Thu Sep 28 15:09:49 UTC 2023
    - 3.3K bytes
    - Viewed (0)
  5. platforms/core-runtime/functional/src/test/groovy/org/gradle/internal/io/IoFunctionTest.groovy

     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    package org.gradle.internal.io
    
    
    import static org.gradle.internal.io.IoFunction.wrap
    
    class IoFunctionTest extends AbstractIoTest {
    
        def "executed when it doesn't throw"() {
            expect:
            wrap({ String t -> "wrapped:$t" }).apply("lajos") == "wrapped:lajos"
        }
    
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Fri Sep 22 08:22:02 UTC 2023
    - 1.1K bytes
    - Viewed (0)
  6. platforms/jvm/normalization-java/src/main/java/org/gradle/api/internal/changedetection/state/FallbackHandlingResourceHasher.java

    import org.gradle.internal.fingerprint.hashing.ZipEntryContext;
    import org.gradle.internal.hash.HashCode;
    import org.gradle.internal.hash.Hasher;
    import org.gradle.internal.io.IoFunction;
    import org.gradle.internal.io.IoSupplier;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    
    import javax.annotation.Nullable;
    import java.io.ByteArrayInputStream;
    import java.io.IOException;
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Thu Sep 28 15:09:49 UTC 2023
    - 6K bytes
    - Viewed (0)
  7. platforms/core-runtime/files/src/main/java/org/gradle/api/internal/file/archive/impl/AbstractZipEntry.java

        }
    
        @Override
        public int size() {
            return (int) entry.getSize();
        }
    
        @Override
        public byte[] getContent() throws IOException {
            return withInputStream(new IoFunction<InputStream, byte[]>() {
                @Override
                public byte[] apply(InputStream inputStream) throws IOException {
                    int size = size();
                    if (size >= 0) {
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Tue May 28 12:11:00 UTC 2024
    - 2.3K bytes
    - Viewed (0)
  8. platforms/jvm/normalization-java/src/test/groovy/org/gradle/api/internal/changedetection/state/LineEndingNormalizingResourceHasherTest.groovy

    import org.gradle.internal.fingerprint.hashing.ResourceHasher
    import org.gradle.internal.fingerprint.hashing.ZipEntryContext
    import org.gradle.internal.hash.Hashing
    import org.gradle.internal.io.IoFunction
    import org.gradle.internal.snapshot.RegularFileSnapshot
    import spock.lang.Specification
    import spock.lang.TempDir
    
    import java.nio.charset.Charset
    
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Thu Sep 28 15:09:49 UTC 2023
    - 7.9K bytes
    - Viewed (0)
  9. platforms/core-runtime/files/src/main/java/org/gradle/api/internal/file/archive/impl/StreamZipInput.java

            private boolean opened;
    
            public StreamZipEntry(java.util.zip.ZipEntry entry) {
                super(entry);
            }
    
            @Override
            public <T> T withInputStream(IoFunction<InputStream, T> action) throws IOException {
                if (opened) {
                    throw new IllegalStateException("The input stream for " + getName() + " has already been opened.  It cannot be reopened again.");
                }
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Tue May 28 12:11:00 UTC 2024
    - 2.7K bytes
    - Viewed (0)
  10. platforms/core-runtime/files/src/main/java/org/gradle/api/internal/file/archive/impl/FileZipInput.java

        private class FileZipEntry extends AbstractZipEntry {
            public FileZipEntry(java.util.zip.ZipEntry entry) {
                super(entry);
            }
    
            @Override
            public <T> T withInputStream(IoFunction<InputStream, T> action) throws IOException {
                InputStream inputStream = getInputStream();
                try {
                    return action.apply(inputStream);
                } finally {
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Tue May 28 12:11:00 UTC 2024
    - 3.9K bytes
    - Viewed (0)
Back to top