1 11 package org.eclipse.update.internal.core; 12 import java.io.*; 13 import java.net.*; 14 15 import org.eclipse.core.runtime.*; 16 17 public class FileResponse implements Response { 18 19 protected URL url; 20 protected long lastModified; 21 22 public FileResponse(URL url) { 23 this.url = url; 24 } 25 26 public InputStream getInputStream() throws IOException { 27 return url.openStream(); 28 } 29 30 public InputStream getInputStream(IProgressMonitor monitor) 31 throws IOException, CoreException { 32 return getInputStream(); 33 } 34 35 public long getContentLength() { 36 return 0; 37 } 38 39 public int getStatusCode() { 40 return IStatusCodes.HTTP_OK; 41 } 42 43 public String getStatusMessage() { 44 return ""; } 46 47 public long getLastModified() { 48 if (lastModified == 0) { 49 File f = new File(url.getFile()); 50 if (f.isDirectory()) 51 f = new File(f, "site.xml"); lastModified = f.lastModified(); 53 } 54 return lastModified; 55 } 56 } 57 | Popular Tags |