package sklep.klient_rest;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;

public class P01_Url {

	public static void main(String[] args) {
		try {
			URL url = new URL("http://localhost:8080/PC33-RestSerwer/products.json");
			try(InputStream inputStream = url.openStream()) {
				Files.copy(inputStream, Paths.get("wynik01.json"), StandardCopyOption.REPLACE_EXISTING);
				System.out.println("OK");
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
