1 package org.sapia.resource; 2 3 import java.io.ByteArrayInputStream ; 4 import java.io.IOException ; 5 import java.io.InputStream ; 6 7 12 public class StringResource implements Resource { 13 14 private String _string, _uri; 15 16 public StringResource(String uri, String str) { 17 _string = str; 18 _uri = uri; 19 } 20 21 public long lastModified() { 22 return -1; 23 } 24 25 public InputStream getInputStream() throws IOException { 26 return new ByteArrayInputStream (_string.getBytes()); 27 } 28 29 public String getURI() { 30 return _uri; 31 } 32 33 36 public Resource getRelative(String uri) throws IOException { 37 throw new UnsupportedOperationException (); 38 } 39 } 40 | Popular Tags |