/** * Checks that an input is is non-null, a URL or a file, exists, * and if its a file then it is not a directory and is readable. If any * condition is false then a runtime exception is thrown. * * @param input the input to check for validity */ public static void assertInputIsValid(final String input) { if (input == null) { throw new IllegalArgumentException("Cannot check validity of null input."); } if (!isUrl(input)) { assertFileIsReadable(new File(input)); } }
/** * Checks that an input is is non-null, a URL or a file, exists, * and if its a file then it is not a directory and is readable. If any * condition is false then a runtime exception is thrown. * * @param input the input to check for validity */ public static void assertInputIsValid(final String input) { if (input == null) { throw new IllegalArgumentException("Cannot check validity of null input."); } if (!isUrl(input)) { assertFileIsReadable(new File(input)); } }
else if(IOUtil.isUrl(file))