/** * Read file or url specified by <tt>path</tt>. * @return file or url content as <tt>byte[]</tt> or as <tt>String</tt> if * <tt>convertToString</tt> is true. */ private static Object readFileOrUrl(String path, boolean convertToString) throws IOException { return SourceReader.readFileOrUrl(path, convertToString, shellContextFactory.getCharacterEncoding()); }
/** * Read file or url specified by <tt>path</tt>. * @return file or url content as <tt>byte[]</tt> or as <tt>String</tt> if * <tt>convertToString</tt> is true. */ private static Object readFileOrUrl(String path, boolean convertToString) throws IOException { return SourceReader.readFileOrUrl(path, convertToString, shellContextFactory.getCharacterEncoding()); }
private String readSource(File f) { String absPath = f.getAbsolutePath(); if (!f.isFile()) { addError("msg.jsfile.not.found", absPath); return null; } try { return (String)SourceReader.readFileOrUrl(absPath, true, characterEncoding); } catch (FileNotFoundException ex) { addError("msg.couldnt.open", absPath); } catch (IOException ioe) { addFormatedError(ioe.toString()); } return null; }
private String readSource(File f) { String absPath = f.getAbsolutePath(); if (!f.isFile()) { addError("msg.jsfile.not.found", absPath); return null; } try { return (String)SourceReader.readFileOrUrl(absPath, true, characterEncoding); } catch (FileNotFoundException ex) { addError("msg.couldnt.open", absPath); } catch (IOException ioe) { addFormatedError(ioe.toString()); } return null; }
/** * Read file or url specified by <tt>path</tt>. * @return file or url content as <tt>byte[]</tt> or as <tt>String</tt> if * <tt>convertToString</tt> is true. */ private static Object readFileOrUrl(String path, boolean convertToString) { try { return SourceReader.readFileOrUrl(path, convertToString, shellContextFactory.getCharacterEncoding()); } catch (IOException ex) { Context.reportError(ToolErrorReporter.getMessage( "msg.couldnt.read.source", path, ex.getMessage())); return null; } } }