Java Jar Entry isNativeLibrary(JarEntry entry)

Here you can find the source of isNativeLibrary(JarEntry entry)

Description

is Native Library

License

Apache License

Declaration

public static boolean isNativeLibrary(JarEntry entry) 

Method Source Code

//package com.java2s;
/*//from w  ww  . j  a v  a2s.  com
 * Licensed to the Indoqa Software Design und Beratung GmbH (Indoqa) under
 * one or more contributor license agreements. See the NOTICE file distributed
 * with this work for additional information regarding copyright ownership.
 * Indoqa licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.util.Arrays;

import java.util.List;

import java.util.jar.JarEntry;

public class Main {
    public static final List<String> NATIVE_LIB_FILE_TYPES = Arrays
            .asList(new String[] { "so", "sl", "dylib", "dll", "lib" });

    public static boolean isNativeLibrary(JarEntry entry) {
        String name = entry.getName();

        int dotSeperatorPosition = name.lastIndexOf('.');
        if (dotSeperatorPosition <= 0) {
            return false;
        }

        String type = name.substring(dotSeperatorPosition + 1);
        if (NATIVE_LIB_FILE_TYPES.contains(type)) {
            return true;
        }

        return false;
    }
}

Related

  1. getJarEntry(JarFile file, String entryName)
  2. hasClassEntry(JarFile jarFile, String className)
  3. inClasspath(Collection classpath, JarEntry entry)
  4. isJavaClass(JarEntry je)
  5. isJavaLibrary(JarEntry entry)
  6. parseSimpleName(JarEntry entry)
  7. trimEntryName(JarEntry je)