Java Code Examples for java.net.JarURLConnection#setDefaultUseCaches()

The following examples show how to use java.net.JarURLConnection#setDefaultUseCaches() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JarURLConnectionUseCaches.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main( String[] args ) throws IOException {
    JarOutputStream out = new JarOutputStream(
            new FileOutputStream("usecache.jar"));
    out.putNextEntry(new JarEntry("test.txt"));
    out.write("Test txt file".getBytes());
    out.closeEntry();
    out.close();

    URL url = new URL("jar:"
        + new File(".").toURI().toString()
        + "/usecache.jar!/test.txt");

    JarURLConnection c1 = (JarURLConnection)url.openConnection();
    c1.setDefaultUseCaches( false );
    c1.setUseCaches( true );
    c1.connect();

    JarURLConnection c2 = (JarURLConnection)url.openConnection();
    c2.setDefaultUseCaches( false );
    c2.setUseCaches( true );
    c2.connect();

    c1.getInputStream().close();
    c2.getInputStream().read();
    c2.getInputStream().close();
}
 
Example 2
Source File: JarURLConnectionUseCaches.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main( String[] args ) throws IOException {
    JarOutputStream out = new JarOutputStream(
            new FileOutputStream("usecache.jar"));
    out.putNextEntry(new JarEntry("test.txt"));
    out.write("Test txt file".getBytes());
    out.closeEntry();
    out.close();

    URL url = new URL("jar:"
        + new File(".").toURI().toString()
        + "/usecache.jar!/test.txt");

    JarURLConnection c1 = (JarURLConnection)url.openConnection();
    c1.setDefaultUseCaches( false );
    c1.setUseCaches( true );
    c1.connect();

    JarURLConnection c2 = (JarURLConnection)url.openConnection();
    c2.setDefaultUseCaches( false );
    c2.setUseCaches( true );
    c2.connect();

    c1.getInputStream().close();
    c2.getInputStream().read();
    c2.getInputStream().close();
}
 
Example 3
Source File: JarURLConnectionUseCaches.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main( String[] args ) throws IOException {
    JarOutputStream out = new JarOutputStream(
            new FileOutputStream("usecache.jar"));
    out.putNextEntry(new JarEntry("test.txt"));
    out.write("Test txt file".getBytes());
    out.closeEntry();
    out.close();

    URL url = new URL("jar:"
        + new File(".").toURI().toString()
        + "/usecache.jar!/test.txt");

    JarURLConnection c1 = (JarURLConnection)url.openConnection();
    c1.setDefaultUseCaches( false );
    c1.setUseCaches( true );
    c1.connect();

    JarURLConnection c2 = (JarURLConnection)url.openConnection();
    c2.setDefaultUseCaches( false );
    c2.setUseCaches( true );
    c2.connect();

    c1.getInputStream().close();
    c2.getInputStream().read();
    c2.getInputStream().close();
}
 
Example 4
Source File: JarURLConnectionUseCaches.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main( String[] args ) throws IOException {
    JarOutputStream out = new JarOutputStream(
            new FileOutputStream("usecache.jar"));
    out.putNextEntry(new JarEntry("test.txt"));
    out.write("Test txt file".getBytes());
    out.closeEntry();
    out.close();

    URL url = new URL("jar:"
        + new File(".").toURI().toString()
        + "/usecache.jar!/test.txt");

    JarURLConnection c1 = (JarURLConnection)url.openConnection();
    c1.setDefaultUseCaches( false );
    c1.setUseCaches( true );
    c1.connect();

    JarURLConnection c2 = (JarURLConnection)url.openConnection();
    c2.setDefaultUseCaches( false );
    c2.setUseCaches( true );
    c2.connect();

    c1.getInputStream().close();
    c2.getInputStream().read();
    c2.getInputStream().close();
}
 
Example 5
Source File: JarURLConnectionUseCaches.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main( String[] args ) throws IOException {
    JarOutputStream out = new JarOutputStream(
            new FileOutputStream("usecache.jar"));
    out.putNextEntry(new JarEntry("test.txt"));
    out.write("Test txt file".getBytes());
    out.closeEntry();
    out.close();

    URL url = new URL("jar:"
        + new File(".").toURI().toString()
        + "/usecache.jar!/test.txt");

    JarURLConnection c1 = (JarURLConnection)url.openConnection();
    c1.setDefaultUseCaches( false );
    c1.setUseCaches( true );
    c1.connect();

    JarURLConnection c2 = (JarURLConnection)url.openConnection();
    c2.setDefaultUseCaches( false );
    c2.setUseCaches( true );
    c2.connect();

    c1.getInputStream().close();
    c2.getInputStream().read();
    c2.getInputStream().close();
}
 
Example 6
Source File: JarURLConnectionUseCaches.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main( String[] args ) throws IOException {
    JarOutputStream out = new JarOutputStream(
            new FileOutputStream("usecache.jar"));
    out.putNextEntry(new JarEntry("test.txt"));
    out.write("Test txt file".getBytes());
    out.closeEntry();
    out.close();

    URL url = new URL("jar:"
        + new File(".").toURI().toString()
        + "/usecache.jar!/test.txt");

    JarURLConnection c1 = (JarURLConnection)url.openConnection();
    c1.setDefaultUseCaches( false );
    c1.setUseCaches( true );
    c1.connect();

    JarURLConnection c2 = (JarURLConnection)url.openConnection();
    c2.setDefaultUseCaches( false );
    c2.setUseCaches( true );
    c2.connect();

    c1.getInputStream().close();
    c2.getInputStream().read();
    c2.getInputStream().close();
}
 
Example 7
Source File: JarURLConnectionUseCaches.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main( String[] args ) throws IOException {
    JarOutputStream out = new JarOutputStream(
            new FileOutputStream("usecache.jar"));
    out.putNextEntry(new JarEntry("test.txt"));
    out.write("Test txt file".getBytes());
    out.closeEntry();
    out.close();

    URL url = new URL("jar:"
        + new File(".").toURI().toString()
        + "/usecache.jar!/test.txt");

    JarURLConnection c1 = (JarURLConnection)url.openConnection();
    c1.setDefaultUseCaches( false );
    c1.setUseCaches( true );
    c1.connect();

    JarURLConnection c2 = (JarURLConnection)url.openConnection();
    c2.setDefaultUseCaches( false );
    c2.setUseCaches( true );
    c2.connect();

    c1.getInputStream().close();
    c2.getInputStream().read();
    c2.getInputStream().close();
}