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

de.schlichtherle.truezip.zip.ZipParametersUtils Maven / Gradle / Ivy

Go to download

The file system driver family for ZIP and related archive file types. Add the JAR artifact of this module to the run time class path to make its file system drivers available for service location in the client API modules.

There is a newer version: 7.7.10
Show newest version
/*
 * Copyright (C) 2005-2013 Schlichtherle IT Services.
 * All rights reserved. Use is subject to license terms.
 */
package de.schlichtherle.truezip.zip;

import javax.annotation.CheckForNull;
import javax.annotation.concurrent.ThreadSafe;

/**
 * Provides static utility methods for ZIP parameters.
 * 
 * @author Christian Schlichtherle
 */
@ThreadSafe
final class ZipParametersUtils {

    private ZipParametersUtils() {
    }

    /**
     * Searches for {@code ZipParameters} of the given type starting from
     * the given parameters.
     * 
     * @param  

the type of the ZIP parameters to search for. * @param type the type of the ZIP parameters to search for. * @param param the parameters for starting the search. * @return The parameters of the given type. * @throws ZipParametersException if {@code param} is {@code null} or * no suitable parameters can get found. */ static

P parameters( final Class

type, @CheckForNull ZipParameters param) throws ZipParametersException { while (null != param) { // Order is important here to support multiple interface implementations! if (type.isInstance(param)) { return type.cast(param); } else if (param instanceof ZipParametersProvider) { param = ((ZipParametersProvider) param).get(type); } else { break; } } throw new ZipParametersException("No suitable ZIP parameters available!"); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy