Answers for "download a file from url jaba"

0

java download file from url

InputStream in = new URL(FILE_URL).openStream();Files.copy(in, Paths.get(FILE_NAME), StandardCopyOption.REPLACE_EXISTING);
Posted by: Guest on September-11-2020
0

java download file from url to string

public static String URLReader(URL url) throws IOException {
    StringBuilder sb = new StringBuilder();
    String line;
 
    InputStream in = url.openStream();
    try {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        while ((line = reader.readLine()) != null) {
            sb.append(line).append(System.lineSeparator());
        }
    } finally {
        in.close();
    }
 
    return sb.toString();
}
Posted by: Guest on May-14-2020

Code answers related to "download a file from url jaba"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language