List of usage examples for java.io File isFile
public boolean isFile()
From source file:Main.java
public static boolean isUnzippable(File path) { return (path.isFile() && path.canRead() && path.getName().endsWith(".zip")); }
From source file:Main.java
public static long getFileSize(String filename) { File file = new File(filename); if (!file.exists() || !file.isFile()) { System.out.println("File doesn\'t exist"); return -1; }//from www .jav a2 s . c o m return file.length(); }
From source file:Main.java
public static void getAllFileAndFolder(File folder, Set<File> all) { all.add(folder);/*w w w. j a v a 2 s.c o m*/ if (folder.isFile()) { return; } for (File file : folder.listFiles()) { all.add(file); if (file.isDirectory()) { getAllFileAndFolder(file, all); } } }
From source file:Main.java
public static final boolean isFileValid(File file) { return file.exists() ? file.isFile() : false; }
From source file:Main.java
public static long getTotalSizeOfFilesInDir(final File file) { if (file.isFile()) return file.length(); final File[] children = file.listFiles(); long total = 0; if (children != null) for (final File child : children) total += getTotalSizeOfFilesInDir(child); return total; }
From source file:Main.java
private static boolean doesFileExist(String filePath) { File f = new File(filePath); if (f.isFile()) return true; return false; }
From source file:Main.java
private static File[] listFiles(File dir) { File[] fileList = dir.listFiles(new FileFilter() { public boolean accept(File file) { return file.isFile(); }/*from w w w. j a va 2s .c om*/ }); return fileList; }
From source file:Main.java
public static long getFileSize(File file) { if (file.exists() && file.isFile()) { return file.length(); }/*from ww w. j ava 2 s . c o m*/ return 0; }
From source file:Main.java
public static void deleteFile(String sPath) { File file = new File(sPath); if (file.isFile() && file.exists()) { file.delete();//from ww w. j a v a 2s . c om } }
From source file:Main.java
public static long getLength(String path) { File file = new File(path); if (!file.isFile() || !file.exists()) { return 0; }//from w w w . ja v a 2 s .c o m return file.length(); }