- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {}
FileObject fileObject = VFS.resolveFile(filePath); OutputStreamWriter write = new OutputStreamWriter( fileObject.getOutputStream(), fileFormat.getEncoding()); BufferedWriter writer = new BufferedWriter(write); writer.write(fileContent);
/** * 将修改后的xml写入xml树 * * @param filePath * @param xmlNode */ private static void writeToXml(String filePath, XmlNode xmlNode, String encoding) { try { if (StringUtil.isBlank(encoding)) { encoding = FlowComponentConstants.DEFAULT_ENCODING; } FileObject fileObject = VFS.resolveFile(filePath); XmlNode xn = new XmlNode(XmlNodeType.XML_DECLARATION); xn.setAttribute("version", "1.0"); xn.setAttribute("encoding", encoding); StringBuffer sb = new StringBuffer(); sb.append(xn); sb.append(xmlNode); StreamUtil.writeText(sb.toString(), fileObject.getOutputStream(), encoding, true); } catch (Exception e) { LOGGER.logMessage(LogLevel.ERROR, "将修改后的xml内容导出到xml树:{0}时失败,错误信息:{1}", filePath, e); throw new FlowComponentException( FlowComponentExceptionErrorCode.OBJECT_SAVE_TO_FILE_FAILED, xmlNode.getClass().getName(), filePath, e); } }
wb.write(excelFile.getOutputStream()); } finally { wb.close();
printer = new CSVPrinter(new OutputStreamWriter(csvFile.getOutputStream(), encode), (CSVFormat) (CSVFormat.class.getDeclaredField(type).get(CSVFormat.class))); } catch (NoSuchFieldException e) {