Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
358 B
3
Indexable
Never
    static void saveImageFromUrl(String imageUrl, String fileName) throws IOException {
        URL url = new URL(imageUrl);
        Path savePath = Path.of("./saveScreen", fileName);

        if (!Files.exists(savePath)) {
            Files.createDirectories(savePath.getParent());
            Files.copy(url.openStream(), savePath);
        }
    }