1 14 package org.wings.template; 15 16 import java.io.IOException ; 17 import java.io.InputStream ; 18 19 26 public class StreamTemplateSource implements TemplateSource { 27 30 private static final boolean DEBUG = true; 31 32 35 private InputStream iStream; 36 37 40 private long modificationTime; 41 42 47 public StreamTemplateSource(InputStream iStream) { 48 setInputStream(iStream); 49 } 50 51 56 public void setInputStream(InputStream iStream) { 57 if (iStream == null) { 58 throw new IllegalArgumentException ("stream is null, this is invalid!!"); 59 } 60 this.iStream = iStream; 61 setModificationTime(); 62 } 63 64 67 public void setModificationTime() { 68 modificationTime = System.currentTimeMillis(); 69 } 70 71 76 public String getCanonicalName() { 77 return null; 78 } 79 80 91 public long lastModified() { 92 return modificationTime; 93 } 94 95 100 public InputStream getInputStream() throws IOException { 101 iStream.reset(); 102 return iStream; 103 } 104 } 105 106 107 | Popular Tags |