Answers for "how to extract image from server url and store it in a folder in java"

0

how to extract image from server url and store it in a folder in java

try (BufferedInputStream inputStream = new BufferedInputStream(new URL("http://example.com/my-file-path.txt").openStream());
  FileOutputStream fileOS = new FileOutputStream("/Users/username/Documents/file_name.txt")) {
    byte data[] = new byte[1024];
    int byteContent;
    while ((byteContent = inputStream.read(data, 0, 1024)) != -1) {
        fileOS.write(data, 0, byteContent);
    }
} catch (IOException e) {
    // handles IO exceptions
}
Posted by: Guest on February-26-2021

Code answers related to "how to extract image from server url and store it in a folder in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language