Package org.jboss.virtual.protocol.vfsjar

Source Code of org.jboss.virtual.protocol.vfsjar.Handler

/*    */ package org.jboss.virtual.protocol.vfsjar;
/*    */
/*    */ import java.io.IOException;
/*    */ import java.io.InputStream;
/*    */ import java.io.PrintStream;
/*    */ import java.net.URL;
/*    */ import java.net.URLConnection;
/*    */ import java.net.URLStreamHandler;
/*    */ import org.jboss.virtual.plugins.vfs.VirtualFileURLConnection;
/*    */
/*    */ public class Handler extends URLStreamHandler
/*    */ {
/*    */   protected URLConnection openConnection(URL u)
/*    */     throws IOException
/*    */   {
/* 42 */     String urlString = u.toString();
/* 43 */     int index = urlString.indexOf("!/");
/* 44 */     String file = urlString.substring(3, index + 2);
/* 45 */     String path = urlString.substring(index + 2);
/* 46 */     URL url = new URL(file);
/* 47 */     return new VirtualFileURLConnection(u, url, path);
/*    */   }
/*    */
/*    */   public static void main(String[] args) throws Exception
/*    */   {
/* 52 */     System.setProperty("java.protocol.handler.pkgs", "org.jboss.virtual.protocol");
/*    */
/* 55 */     URL url = new URL("vfsjar:file:/c:/tmp/parent.jar!/foo.jar/urlstream.java");
/* 56 */     InputStream is = url.openStream();
/* 57 */     while (is.available() != 0)
/*    */     {
/* 59 */       System.out.print((char)is.read());
/*    */     }
/* 61 */     is.close();
/*    */   }
/*    */ }

/* Location:           /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/jboss-embedded-all.jar
* Qualified Name:     org.jboss.virtual.protocol.vfsjar.Handler
* JD-Core Version:    0.6.0
*/
TOP

Related Classes of org.jboss.virtual.protocol.vfsjar.Handler

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.