src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Source.java

Print this page

        

*** 482,491 **** --- 482,515 ---- /** * Constructor * * @param name source name + * @param path path from which source can be loaded + * + * @return source instance + * + * @throws IOException if source cannot be loaded + */ + public static Source sourceFor(final String name, final Path path) throws IOException { + File file = null; + try { + file = path.toFile(); + } catch (final UnsupportedOperationException uoe) { + } + + if (file != null) { + return sourceFor(name, file); + } else { + return sourceFor(name, Files.newBufferedReader(path)); + } + } + + /** + * Constructor + * + * @param name source name * @param file file from which source can be loaded * @param cs Charset used to convert bytes to chars * * @return source instance *
*** 599,609 **** return data.url(); } /** * Get explicit source URL. ! * @return URL set vial sourceURL directive */ public String getExplicitURL() { return explicitURL; } --- 623,633 ---- return data.url(); } /** * Get explicit source URL. ! * @return URL set via sourceURL directive */ public String getExplicitURL() { return explicitURL; }