| 1 package org.jicengine.io; 2 3 import java.io.*; 4 5 29 30 public class StringResource extends AbstractResource { 31 32 private String text; 33 private Resource locatorResource; 34 35 41 public StringResource(String identifier, String text, Resource locatorResource) 42 { 43 super(identifier); 44 this.text = text; 45 this.locatorResource = locatorResource; 46 } 47 48 public String getText() 49 { 50 return this.text; 51 } 52 53 public boolean isAvailable() 54 { 55 return true; 56 } 57 58 public InputStream getInputStream() throws java.io.IOException  59 { 60 return new StringBufferInputStream(getText()); 61 } 62 63 public Reader getReader() throws java.io.IOException  64 { 65 return new StringReader(getText()); 66 } 67 68 public Resource getResource(String relativePath) throws IOException 69 { 70 return this.locatorResource.getResource(relativePath); 71 } 72 73 } 74 | Popular Tags |