private Node parse(ThreadContext context, FileResource file, String fileName) throws IOException { try (InputStream stream = file.openInputStream()) { return context.runtime.parseFile(stream, fileName, null, 0); } } }
private Node parse(ThreadContext context, FileResource file, String fileName) throws IOException { try (InputStream stream = file.openInputStream()) { return context.runtime.parseFile(stream, fileName, null, 0); } } }
return findScript(resource.openInputStream()); return resource.openInputStream();
return findScript(resource.openInputStream()); return resource.openInputStream();
/** * @deprecated * * Opens a new input stream to read the contents of a resource and returns it. * Note that implementations may be allocating native memory for the stream, so * callers need to close this when they are done with it. users of this * method should follow the pattern: close the stream where you open it. * * @return just opened InputStream * @throws ResourceException is the file does not exists or if the resource is a directory */ default InputStream inputStream() throws ResourceException { if (!exists()) { throw new ResourceException.NotFound(absolutePath()); } if (isDirectory()) { throw new ResourceException.FileIsDirectory(absolutePath()); } try { return openInputStream(); } catch (IOException e) { throw new ResourceException.IOError(e); } }
/** * @deprecated * * Opens a new input stream to read the contents of a resource and returns it. * Note that implementations may be allocating native memory for the stream, so * callers need to close this when they are done with it. users of this * method should follow the pattern: close the stream where you open it. * * @return just opened InputStream * @throws ResourceException is the file does not exists or if the resource is a directory */ default InputStream inputStream() throws ResourceException { if (!exists()) { throw new ResourceException.NotFound(absolutePath()); } if (isDirectory()) { throw new ResourceException.FileIsDirectory(absolutePath()); } try { return openInputStream(); } catch (IOException e) { throw new ResourceException.IOError(e); } }