Sample 0 [from 544 instances]

Class140.openConnection(String url)#2{
    if (proxy != null)
      urlConnection = (HttpURLConnectionu.openConnection(proxy);
    else
      urlConnection = (HttpURLConnectionu.openConnection();
    urlConnection.setRequestProperty("User-Agent", userAgent);
}


Sample 1 [from 357 instances]

Class1360.getInputStream(String publicid,String systemid){
    URL basis = new URL("file""", System.getProperty("user.dir""/.");
    URL url = new URL(basis, systemid);
    URLConnection c = url.openConnection();
    return c.getInputStream();
}


Sample 2 [from 146 instances]

Class350.test_getContentType(){
        URL u = copyAndOpenResourceStream("lf.jar""");
        assertEquals("Returned incorrect type for jar file""x-java/jar",
                u.openConnection().getContentType());
        u = copyAndOpenResourceStream("lf.jar""plus.bmp");
        assertEquals("Returned incorrect type for the entry with known type",
                "image/x-ms-bmp", u.openConnection().getContentType());
        u = copyAndOpenResourceStream("lf.jar""Manifest.mf");
        assertEquals("Returned incorrect type for the entry with known type",
                "content/unknown", u.openConnection().getContentType());
}


Sample 3 [from 56 instances]

Class1060.run()#0{
                    URL url = classLoader.getResource(resourceName);
                    if (url != null) {
                      URLConnection connection = url.openConnection();
                      if (connection != null) {
                        connection.setUseCaches(false);
                        is = connection.getInputStream();
                      }
                    }
}


Sample 4 [from 28 instances]

Class250.getPluginResource(String pluginName,String resourceUrl){
        URL url = getPluginResourceURL(pluginName, resourceUrl);
        if (url != null) {
            // get inputstream from url
            if (url != null) {
                result = url.openConnection().getInputStream();
            }
        }
}


Sample 5 [from 18 instances]

Class830.createHttpConnection(URI uri)#1{
    URL url = uri.toURL();
    HttpsURLConnection connection = (HttpsURLConnectionurl
        .openConnection();
}


Sample 6 [from 16 instances]

Class110.BinaryIn(URL url)#0{
            URLConnection site = url.openConnection();
            InputStream is     = site.getInputStream();
            in = new BufferedInputStream(is);
}


Sample 7 [from 15 instances]

Class1460.createNonNestedUrlFromString()#0{
    assertThat(inputStream.read(), equalTo(2));
    JarURLConnection connection = (JarURLConnectionurl.openConnection();
}


Sample 8 [from 14 instances]

Class600.getBufferedReader(URL source){
        URLConnection conn = source.openConnection();
        boolean isGzipped = conn.getContentType() != null && conn.getContentType().equalsIgnoreCase("application/x-gzip")
                || conn.getContentEncoding() != null && conn.getContentEncoding().equalsIgnoreCase("gzip");
        InputStream uis = conn.getInputStream();
        return new BufferedReader(isGzipped?
            new InputStreamReader(new GZIPInputStream(uis)):
            new InputStreamReader(uis));    
}


Sample 9 [from 14 instances]

Class320.ExpressSchemaParser(URL url)#0{
      this.inputStream = url.openConnection().getInputStream();
}


Sample 10 [from 12 instances]

Class1390.resolveModuleEntriesFromJar(URL url,String _prefix)#0{
        JarURLConnection conn = (JarURLConnectionurl.openConnection();
        Enumeration entries = conn.getJarFile().entries();
        while (entries.hasMoreElements())
        {
            JarEntry entry = (JarEntryentries.nextElement();
            String name = entry.getName();
            if (name.startsWith(prefix&& !entry.isDirectory())
            {
                resourceList.add(name);
            }
        }
}


Sample 11 [from 11 instances]

Class800.getJSONObject(URL jsonURL)#1{
    URLConnection conn = jsonURL.openConnection();
    BufferedReader reader = new BufferedReader(new InputStreamReader(
            conn.getInputStream()));
}


Sample 12 [from 10 instances]

Class1500.findSource(URL location){
    URLConnection connection = location.openConnection();
    if (connection instanceof JarURLConnection) {
      return new File(((JarURLConnectionconnection).getJarFile().getName());
    }
    return new File(location.getPath());
}


Sample 13 [from 8 instances]

Class1440.assertJar(URL url)#1{
    URLConnection conn = url.openConnection();
    conn.connect();
    InputStream in = conn.getInputStream();
}


Sample 14 [from 8 instances]

Class1410.openStream(final URL url){
        final URLConnection connection = url.openConnection();
        connection.setUseCaches(false);
        return connection.getInputStream();
}


Sample 15 [from 7 instances]

Class1500.openURLConnection(URL url){
        URLConnection con = url.openConnection();
        con.setConnectTimeout(TIMEOUT);
        con.setReadTimeout(TIMEOUT);
}


Sample 16 [from 5 instances]

Class480.getUrlContent(URL u)#1{
    java.net.URLConnection c = u.openConnection();
    c.connect();
}


Sample 17 [from 5 instances]

Class1370.retriveLastModifiedFromURL(URL url)#1{
            URLConnection con = url.openConnection();
                return con.getLastModified();
}