导出list对象到excel

@param list     导出的list
@param xmlPath  xml完整路径
@param outputStream 输出流
@return 处理结果，true成功，false失败
@throws Exception
359238
public static boolean list2Xls(List<?> list, String xmlPath, OutputStream outputStream) throws Exception {
        return XlsUtil.list2Xls(list, xmlPath, outputStream);
    }
301818
public static void writeWritablesToFile(String outputPath, String delim, List<List<Writable>> writables,
                    JavaSparkContext sc) throws IOException {
        StringBuilder sb = new StringBuilder();
        for (List<Writable> list : writables) {
            boolean first = true;
            for (Writable w : list) {
                if (!first)
                    sb.append(delim);
                sb.append(w.toString());
                first = false;
            }
            sb.append("\n");
        }
        writeStringToFile(outputPath, sb.toString(), sc);
    }
893279
public void writeToExcel(List<? extends Object> datas, boolean hasTitle,
                             OutputStream outputStream, boolean transverse) throws IOException {
        writeToExcel(datas, hasTitle, outputStream, IN_MEMORY, transverse);
    }
9455
public String serializeTransformList(List<Transform> list) {
        ObjectMapper om = getObjectMapper();
        try {
            return om.writeValueAsString(new ListWrappers.TransformList(list));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
1356408
public <T> File writeLines(Collection<T> list, boolean isAppend) throws IORuntimeException {
		return writeLines(list, null, isAppend);
	}
246899
private NodeList getNodeListUsingJavaXPath(String xpath) throws Exception {
		XPathFactory xpathFac = XPathFactory.newInstance();
		XPath theXpath = xpathFac.newXPath();

		String html = getGUIDriver().getHtmlSource();
		html = html.replaceAll(">\\s+<", "><");
		InputStream input = new ByteArrayInputStream(html.getBytes(Charset.forName("UTF-8")));

		XMLReader reader = new Parser();
		reader.setFeature(Parser.namespacesFeature, false);
		Transformer transformer = TransformerFactory.newInstance().newTransformer();

		DOMResult result = new DOMResult();
		transformer.transform(new SAXSource(reader, new InputSource(input)), result);

		Node htmlNode = result.getNode(); // This code gets a Node from the
											// result.
		NodeList nodes = (NodeList) theXpath.evaluate(xpath, htmlNode, XPathConstants.NODESET);

		return nodes;
	}
949528
public static boolean list2Xls(ExcelConfig config, List<?> list, OutputStream outputStream) throws Exception {
        try {
            String[] header = config.getHeaders();
            String[] names = config.getNames();
            String[] values;
            WritableWorkbook wb = Workbook.createWorkbook(outputStream);
            String sheetName = (config.getSheet() != null && !config.getSheet().equals("")) ? config.getSheet() : ("sheet" + config.getSheetNum());
            WritableSheet sheet = wb.createSheet(sheetName, 0);

            int row = 0;
            int column = 0;
            int rowadd = 0;
            //写入标题
            if (config.getHeader()) {
                for (column = 0; column < header.length; column++) {
                    sheet.addCell(new Label(column, row + rowadd, header[column]));
                    if (config.getColumn(column).getWidth() != null) {
                        sheet.setColumnView(column, config.getColumn(column).getWidth() / 7);
                    }
                }
                rowadd++;
            }
            //写入内容//行
            for (row = 0; row < list.size(); row++) {
                Object rowData = list.get(row);
                values = getObjValues(rowData, names);
                //列
                for (column = 0; column < values.length; column++) {
                    sheet.addCell(new Label(column, row + rowadd, values[column]));
                }
            }
            wb.write();
            wb.close();
        } catch (Exception e1) {
            return false;
        }
        return true;
    }
1202508
public static void writeXml(Serializable serializable, OutputStream output) throws IOException {
		TransportFormat.XML.writeSerializableTo(serializable, output);
	}
855588
public static void writeFileList(XMLOutput xmlOutput, String tagName, Iterator<File> listValueIterator) throws IOException {
        while (listValueIterator.hasNext()) {
            xmlOutput.openTag(tagName);
            xmlOutput.writeText(listValueIterator.next().getPath());
            xmlOutput.closeTag(tagName);
        }
    }
1767
public static void writeElementList(XMLOutput xmlOutput, String tagName, Iterable<String> listValues) throws IOException {
        writeElementList(xmlOutput, tagName, listValues.iterator());
    }
973347
public static void writeFile( List<String> lines, String filePath ) throws IOException {
        writeFile(lines, new File(filePath));
    }
1096087
public void exportObjects2Excel(List<?> data, List<String> header, OutputStream os)
            throws IOException {

        try (Workbook workbook = exportExcelBySimpleHandler(data, header, null, true)) {
            workbook.write(os);
        }
    }
205562
public void writeToExcel(List<? extends Object> datas, boolean hasTitle, String path,
                             int inMemory, boolean transverse) throws IOException {
        writeToExcel(datas, hasTitle, new FileOutputStream(path), inMemory, transverse);
    }
1259485
public static boolean writeStream(String filePath, InputStream stream) throws IOException {
        return writeStream(filePath, stream, false);
    }
196146
public static List<?> xls2List(ExcelConfig config, File xlsFile) throws Exception {
        return XlsUtil.xls2List(config, xlsFile);
    }
31426
public static String serializeList(List<?> list) {
        if (list == null) {
            list = new ArrayList<String>();
        }
        XStream xstream = new XStream(new DomDriver());
        return xstream.toXML(list);
    }
611961
public static void writeCustomAttributes(Collection<List<ExtensionAttribute>> attributes, XMLStreamWriter xtw, Map<String, String> namespaceMap, List<ExtensionAttribute>... blackLists)
      throws XMLStreamException {

    for (List<ExtensionAttribute> attributeList : attributes) {
      if (attributeList != null && !attributeList.isEmpty()) {
        for (ExtensionAttribute attribute : attributeList) {
          if (!isBlacklisted(attribute, blackLists)) {
            if (attribute.getNamespacePrefix() == null) {
              if (attribute.getNamespace() == null)
                xtw.writeAttribute(attribute.getName(), attribute.getValue());
              else {
                xtw.writeAttribute(attribute.getNamespace(), attribute.getName(), attribute.getValue());
              }
            } else {
              if (!namespaceMap.containsKey(attribute.getNamespacePrefix())) {
                namespaceMap.put(attribute.getNamespacePrefix(), attribute.getNamespace());
                xtw.writeNamespace(attribute.getNamespacePrefix(), attribute.getNamespace());
              }
              xtw.writeAttribute(attribute.getNamespacePrefix(), attribute.getNamespace(), attribute.getName(), attribute.getValue());
            }
          }
        }
      }
    }
  }