1 6 package fr.jayasoft.ivy.url; 7 8 import java.io.File ; 9 import java.io.IOException ; 10 import java.io.InputStream ; 11 import java.net.URL ; 12 13 import fr.jayasoft.ivy.util.CopyProgressListener; 14 15 22 public interface URLHandler { 23 public static class URLInfo { 24 private long _contentLength; 25 private long _lastModified; 26 private boolean _available; 27 28 protected URLInfo(boolean available, long contentLength, long lastModified) { 29 _available = available; 30 _contentLength = contentLength; 31 _lastModified = lastModified; 32 } 33 public boolean isReachable() { 34 return _available; 35 } 36 public long getContentLength() { 37 return _contentLength; 38 } 39 public long getLastModified() { 40 return _lastModified; 41 } 42 } 43 public static final URLInfo UNAVAILABLE = new URLInfo(false, 0,0); 44 45 50 public boolean isReachable(URL url); 51 56 public boolean isReachable(URL url, int timeout); 57 64 public long getContentLength(URL url); 65 73 public long getContentLength(URL url, int timeout); 74 75 80 public long getLastModified(URL url); 81 86 public long getLastModified(URL url, int timeout); 87 88 93 public URLInfo getURLInfo(URL url); 94 99 public URLInfo getURLInfo(URL url, int timeout); 100 101 public InputStream openStream(URL url) throws IOException ; 102 public void download(URL src, File dest, CopyProgressListener l) throws IOException ; 103 } 104 | Popular Tags |