public static String getContentURL(String URL) throws IOException { File file = new File(Database.convertURLToFileName(URL)); String content = ""; if (file.exists() && !file.isDirectory()) { content = new String(Files.readAllBytes(file.toPath())); } return content; }
public static void saveURL(String URL, InputStream stream) throws IOException { File file = new File(Database.convertURLToFileName(URL)); Path targetPath = file.toPath(); file.mkdirs(); if (file.exists()) { Files.copy(stream, targetPath, StandardCopyOption.REPLACE_EXISTING); } }