当前位置: 首页>>代码示例>>Java>>正文


Java JarURLConnection.setUseCaches方法代码示例

本文整理汇总了Java中java.net.JarURLConnection.setUseCaches方法的典型用法代码示例。如果您正苦于以下问题:Java JarURLConnection.setUseCaches方法的具体用法?Java JarURLConnection.setUseCaches怎么用?Java JarURLConnection.setUseCaches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.net.JarURLConnection的用法示例。


在下文中一共展示了JarURLConnection.setUseCaches方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import java.net.JarURLConnection; //导入方法依赖的package包/类
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();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:JarURLConnectionUseCaches.java

示例2: getJarFile

import java.net.JarURLConnection; //导入方法依赖的package包/类
@Override
public JarFile getJarFile() throws IOException {
    URL jarFileUrl = new URL("jar:" + jarUrl + "!/");
    JarURLConnection conn = (JarURLConnection) jarFileUrl.openConnection();
    conn.setUseCaches(false);
    conn.connect();
    return conn.getJarFile();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:9,代码来源:JarURLResource.java

示例3: getJarFile

import java.net.JarURLConnection; //导入方法依赖的package包/类
private JarFile getJarFile(URL jarFileUrl) throws IOException {
    JarFile jarFile = null;

    if (jarFileUrl != null) {
        JarURLConnection conn = (JarURLConnection) jarFileUrl.openConnection();
        conn.setUseCaches(false);
        conn.connect();
        jarFile = conn.getJarFile();
    }

    return jarFile;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:ParserController.java

示例4: getJarFile

import java.net.JarURLConnection; //导入方法依赖的package包/类
@Override
public JarFile getJarFile() throws IOException {
	URL jarFileUrl = new URL("jar:" + jarUrl + "!/");
	JarURLConnection conn = (JarURLConnection) jarFileUrl.openConnection();
	conn.setUseCaches(false);
	conn.connect();
	return conn.getJarFile();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:9,代码来源:JarURLResource.java

示例5: FileUrlJar

import java.net.JarURLConnection; //导入方法依赖的package包/类
public FileUrlJar(URL url) throws IOException {
    JarURLConnection jarConn = (JarURLConnection) url.openConnection();
    jarConn.setUseCaches(false);
    jarFile = jarConn.getJarFile();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:6,代码来源:FileUrlJar.java

示例6: FileUrlJar

import java.net.JarURLConnection; //导入方法依赖的package包/类
public FileUrlJar(URL url) throws IOException {
	JarURLConnection jarConn = (JarURLConnection) url.openConnection();
	jarConn.setUseCaches(false);
	jarFile = jarConn.getJarFile();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:6,代码来源:FileUrlJar.java


注:本文中的java.net.JarURLConnection.setUseCaches方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。