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