private static RandomAccessInputStream openStream(String file) throws IOException { return new RandomAccessInputStream(getHandle(file), file); }
private static RandomAccessInputStream openStream(String file) throws IOException { return new RandomAccessInputStream(getHandle(file), file); }
/** Returns true if the given filename is a Zip file. */ public static boolean isZipFile(String file) throws IOException { if (!file.toLowerCase().endsWith(".zip")) return false; IRandomAccess handle = getHandle(file); byte[] b = new byte[2]; if (handle.length() >= 2) { handle.read(b); } handle.close(); return new String(b, Constants.ENCODING).equals("PK"); }
/** * @param file a name that can be passed to * {@link Location#getHandle(String, boolean, boolean)} * @return true if the given filename is a Zip file. * @throws IOException if the file cannot be read */ public static boolean isZipFile(String file) throws IOException { if (!file.toLowerCase().endsWith(".zip")) return false; IRandomAccess handle = getHandle(file); byte[] b = new byte[2]; if (handle.length() >= 2) { handle.read(b); } handle.close(); return new String(b, Constants.ENCODING).equals("PK"); }