All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cloudfoundry.multiapps.controller.process.util.ArchiveEntryWithStreamPositions Maven / Gradle / Ivy

There is a newer version: 1.183.0
Show newest version
package org.cloudfoundry.multiapps.controller.process.util;

import java.util.Arrays;

import org.cloudfoundry.multiapps.common.SLException;
import org.cloudfoundry.multiapps.controller.process.Messages;
import org.immutables.value.Value;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@Value.Immutable
@JsonSerialize(as = ImmutableArchiveEntryWithStreamPositions.class)
@JsonDeserialize(as = ImmutableArchiveEntryWithStreamPositions.class)
public interface ArchiveEntryWithStreamPositions {

    String getName();

    long getStartPosition();

    long getEndPosition();

    CompressionMethod getCompressionMethod();

    boolean isDirectory();

    enum CompressionMethod {
        STORED(0), DEFLATED(8);

        private final int value;

        CompressionMethod(int value) {
            this.value = value;
        }

        public static CompressionMethod parseValue(int value) {
            return Arrays.stream(values())
                         .filter(entry -> entry.value == value)
                         .findFirst()
                         .orElseThrow(() -> new SLException(Messages.COMPRESSION_METHOD_WITH_VALUE_0_NOT_FOUND, value));
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy