Java Zip File Check isZipFile(File f)

Here you can find the source of isZipFile(File f)

Description

is Zip File

License

Open Source License

Declaration

public static boolean isZipFile(File f) 

Method Source Code


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

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;

public class Main {
    public static boolean isZipFile(File f) {
        RandomAccessFile r;/*from  w  w w .j  a va2  s.c o m*/
        try {
            r = new RandomAccessFile(f, "r");
            if (r.readInt() == 0x504b0304) {
                r.close();
                return true;
            } else {
                r.close();
                return false;
            }
        } catch (IOException e) {
            return false;
        }
    }
}

Related

  1. isZipContainsEntry(File zip, String relativePath)
  2. isZipEntryPackage(String str)
  3. isZipFile(File f)
  4. isZipFile(File f)
  5. isZipFile(File f)
  6. isZipFile(File f)
  7. isZipFile(File file)
  8. isZipFile(File file)
  9. isZipFile(File file)