Java URL Load load(URL url)

Here you can find the source of load(URL url)

Description

load

License

Open Source License

Declaration

static StringBuffer load(URL url) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.*;
import java.net.URL;

public class Main {
    static StringBuffer load(URL url) {
        try {//w  w w .ja va 2s  .  co  m
            StringBuffer sb = new StringBuffer();
            {
                byte[] buf = new byte[1024];
                int n;
                InputStream is = url.openStream();
                while (-1 != (n = is.read(buf))) {
                    sb.append(new String(buf));
                }
            }
            return sb;
        } catch (Exception e) {
            throw new RuntimeException("Failed to load " + url, e);
        }
    }
}

Related

  1. getManifestAsString(URLClassLoader cl, String jarBaseName)
  2. load(Iterable urls)
  3. load(String fileOrURL)
  4. load(URL pUrl)
  5. load(URL url)
  6. load(URL url, boolean allowCache)
  7. loadByteArray(URL url)
  8. loadFile(String url)
  9. loadFile(URL resource)