Java Zip File Check isZipEntryPackage(String str)

Here you can find the source of isZipEntryPackage(String str)

Description

is Zip Entry Package

License

Open Source License

Declaration

public static boolean isZipEntryPackage(String str) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    public static boolean isZipEntryPackage(String str) {
        if (str.length() < 18)
            return false;
        String t = cleanPath(str);
        String tmp = t.substring(0, 18);
        String test = "replicate" + File.separator + "inbound"
                + File.separator;
        if (tmp.equals(test)) {
            // Check for zip file
            tmp = str.substring(str.length() - 4, str.length());
            if (tmp.equals(".zip"))
                return true;
            else/*  w  w w.j a va  2s . c om*/
                return false;
        } else
            return false;
    }

    /**
     * cleanPath static method replaces all path separators with system dependednt value.
     * For UNIX it is / for Windows - "\\"
     * @param path - string with directory/file path
     * @return String path with system related path separators
     */
    public static String cleanPath(String path) {
        String str = path.replace('/', File.separatorChar);
        String final_str = str.replace('\\', File.separatorChar);
        return final_str;
    }
}

Related

  1. isZip(File file)
  2. isZip(File file)
  3. isZip(File zip)
  4. isZip64EndOfCentralDirectoryLocatorPresent(RandomAccessFile zip, long zipEndOfCentralDirectoryPosition)
  5. isZipContainsEntry(File zip, String relativePath)
  6. isZipFile(File f)
  7. isZipFile(File f)
  8. isZipFile(File f)
  9. isZipFile(File f)