1 16 package scriptella.configuration; 17 18 import scriptella.spi.Resource; 19 20 import java.io.IOException ; 21 import java.io.Reader ; 22 import java.io.StringReader ; 23 24 32 public class StringResource implements Resource { 33 private final String string; 34 private final String description; 35 36 40 public StringResource(String string) { 41 this(string, null); 42 } 43 44 49 public StringResource(String string, String description) { 50 this.string = string; 51 this.description = description; 52 } 53 54 public Reader open() throws IOException { 55 return new StringReader (string); 56 } 57 58 59 62 public String getString() { 63 return string; 64 } 65 66 public String toString() { 67 return description==null?"Text block":description; 68 } 69 } 70 | Popular Tags |