1 17 18 package org.apache.avalon.repository; 19 20 import java.io.IOException ; 21 import java.net.URL ; 22 import java.net.URLConnection ; 23 import java.net.URLStreamHandler ; 24 25 28 public class BlockHandler extends URLStreamHandler 29 { 30 31 38 protected URLConnection openConnection( final URL url ) 39 throws IOException 40 { 41 return new BlockURLConnection( url ); 42 } 43 44 protected int getDefaultPort() 45 { 46 return 0; 47 } 48 49 protected String toExternalForm( URL url ) 50 { 51 StringBuffer result = new StringBuffer ( "block:" ); 52 if (url.getFile() != null ) 53 { 54 result.append(url.getFile()); 55 } 56 if (url.getRef() != null ) 57 { 58 result.append("#"); 59 result.append(url.getRef()); 60 } 61 return result.toString(); 62 } 63 } 64 | Popular Tags |