1 16 package org.outerj.daisy.frontend.util; 17 18 import org.apache.avalon.excalibur.monitor.StreamResource; 19 20 import java.io.*; 21 22 26 public class AltFileResource extends StreamResource { 27 private File file; 28 private long previousLastModified = -1; 29 30 public AltFileResource(File file) throws Exception { 31 super(file.getCanonicalPath()); 32 this.file = file; 33 this.previousLastModified = file.lastModified(); 34 } 35 36 public long lastModified() { 37 long lastModified = file.lastModified(); 38 if (lastModified == 0 && previousLastModified != 0) { 39 previousLastModified = 0; 40 return System.currentTimeMillis(); 41 } else { 42 previousLastModified = lastModified; 43 return lastModified; 44 } 45 } 46 47 public InputStream getResourceAsStream() throws IOException { 48 return null; 50 } 51 52 public Reader getResourceAsReader() throws IOException { 53 return null; 55 } 56 57 public OutputStream setResourceAsStream() throws IOException { 58 return null; 60 } 61 62 public Writer setResourceAsWriter() throws IOException { 63 return null; 65 } 66 } 67 | Popular Tags |