public static byte[] getContent(String file_or_url) { File file = new File(file_or_url); if (file.exists()) { try { return StreamUtils.readAndClose(new FileInputStream(file)); } catch (IOException e) { // ignore } } // try file_or_url as URL return null; }