Løsningsforslag - oppgaver i Vedlegg A.5.1


Oppgave 1

i) Hvis du bruker htp istedenfor http, kommer flg. feilmelding:

  java.net.MalformedURLException: unknown protocol: htp

Oppgave 2

  public static void main(String... args) throws IOException
  {
    String url = "file:///f:/www/appolonius/vedlegg/A/A5.html";
    InputStream inn = (new URL(url)).openStream();
    Path til = Paths.get("f:/www/appolonius/vedlegg/A/A5Kopi.html");
    Files.copy((new URL(url)).openStream(), til);
    inn.close();
  }