List of utility methods to do Is Readable File
boolean | isReachable(String internetProtocolAddress) is Reachable List<String> command = new ArrayList<String>(); command.add("ping"); if (System.getProperty("os.name").startsWith("Windows")) command.add("-n"); } else { command.add("-c"); command.add("1"); command.add(internetProtocolAddress); ProcessBuilder processBuilder = new ProcessBuilder(command); Process process = processBuilder.start(); BufferedReader standardOutput = new BufferedReader(new InputStreamReader(process.getInputStream())); String outputLine; while ((outputLine = standardOutput.readLine()) != null) { if (outputLine.toLowerCase().contains("destination host unreachable")) { return false; return true; |
void | isReadable(File arcFile) is Readable if (!arcFile.exists()) { throw new FileNotFoundException(arcFile.getAbsolutePath() + " does not exist."); if (!arcFile.canRead()) { throw new FileNotFoundException(arcFile.getAbsolutePath() + " is not readable."); |
boolean | isReadable(String filename) Determine if the given filename exists and is readable. if (filename == null) { return false; File file = new File(filename); return file.exists() && file.canRead(); |
boolean | isReadableFile(File f) is Readable File String msg; if (!f.exists()) { msg = "Cannot find file: " + f; log.warn(msg); return false; if (!f.canRead()) { msg = "Cannot read from file: " + f; ... |
boolean | isReadableFile(File file) Returns whether the given file is non-null, a plain file and is readable. return file != null && file.isFile() && file.canRead();
|
boolean | isReadableFile(File file) Check the file can read or not return file != null && file.exists() && file.isFile() && file.canRead();
|
boolean | isReadableFile(File file) is Readable File try { return file != null && file.exists() && file.isFile() && file.canRead(); } catch (SecurityException se) { se.printStackTrace(System.err); return false; |
boolean | isReadableFile(File file) Check if the passed File point to an existing file and can be read by the user. boolean state = true; if (!file.exists() || !file.isFile()) { System.err.println(String.format("%s: does not exist", file.getName())); state = false; } else if (!file.canRead()) { System.err.println(String.format("%s: no read permission", file.getName())); state = false; return state; |
boolean | isReadableFile(File path) Returns true if the specified path represents a readable file, false otherwise. return path.isFile() && path.canRead();
|
String | isReadableFile(final File f) is Readable File if (!f.exists()) { return "\"" + f + "\" does not exist"; if (f.isDirectory()) { return "\"" + f + "\" is a directory"; if (!f.isFile()) { return "\"" + f + "\" is not a file"; ... |