@Override public InputStream getInputStream() throws IOException { return resource.getObject().getInputStream(); }
@Override public long getLastModified() { return resource.getTime(); } }
RAMFile(RAMDir parent, String name, Resource resource) { super(parent, name); // this.resource = new Timestamped<Resource>(System.currentTimeMillis(), resource); }
@Override void touch() { resource = resource.touch(); } }
@Override void touch() { resource = resource.touch(); } }
@Override public InputStream getInputStream() throws IOException { return resource.getObject().getInputStream(); }
@Override public long getLastModified() { return resource.getTime(); } }
RAMFile(RAMDir parent, String name, Resource resource) { super(parent, name); // this.resource = new Timestamped<Resource>(System.currentTimeMillis(), resource); }
@Override public Reader getReader(String resourceName) { Path.Relative partialPath = (Path.Relative)Path.parse(resourceName); Timestamped<Resource> partial = context.resolveResource(partialPath); if (partial != null) { return new StringReader(partial.getObject().getCharSequence().toString()); } else { return null; } }
@Override long getLastModified() { return resource.getTime(); }
public Timestamped<T> touch() { return new Timestamped<T>(System.currentTimeMillis(), object); }
public final InputStream openInputStream() throws IOException { return assertContent().getObject().getInputStream(); }
@Override long getLastModified() { return resource.getTime(); }
public Timestamped<T> touch() { return new Timestamped<T>(System.currentTimeMillis(), object); }
@Override public Reader getReader(String resourceName) { Path.Relative partialPath = (Path.Relative)Path.parse(resourceName); Timestamped<Resource> partial = context.resolveResource(partialPath); if (partial != null) { return new StringReader(partial.getObject().getCharSequence().toString()); } else { return null; } }
public long getLastModified() { try { return assertContent().getTime(); } catch (IOException e) { // We return 0 as the javadoc say to do return 0; } }
@Override public Timestamped<Resource> getResource(File file) throws IOException { FileInputStream in = new FileInputStream(file); try { ByteArrayOutputStream resource = new ByteArrayOutputStream(); byte[] buffer = new byte[256]; for (int l = in.read(buffer);l != -1;l = in.read(buffer)) { resource.write(buffer, 0, l); } return new Timestamped<Resource>(file.lastModified(), new Resource(resource.toByteArray(), encoding)); } finally { Tools.safeClose(in); } }
public final CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { return assertContent().getObject().getCharSequence(); }