导入xls到List

@param xmlPath     xml完整路径
@param inputStream xls文件流
@return List对象
@throws Exception
765386
public static List<?> xls2List(String xmlPath, InputStream inputStream) throws Exception {
        return XlsUtil.xls2List(xmlPath, inputStream);
    }
196146
public static List<?> xls2List(ExcelConfig config, File xlsFile) throws Exception {
        return XlsUtil.xls2List(config, xlsFile);
    }
315011
private String readContent(java.io.InputStream in) throws Exception {

        StringBuffer resultBuffer = new StringBuffer();
        SAXReader reader = new SAXReader();
        Document doc = reader.read(in);
        List<Node> textlist = CmsXmlGenericWrapper.selectNodes(doc, "//text:p[@*] | //text:span[@*]");
        Iterator<Node> li = textlist.iterator();
        while (li.hasNext()) {
            Node textNode = li.next();
            String text = textNode.getText();
            if (text.length() > 1) {
                text = " " + text + " ";
                resultBuffer.append(text);
            }
        }
        return resultBuffer.toString();
    }
923607
public List<List<String>> readExcel2List(String excelPath, int offsetLine)
            throws IOException, InvalidFormatException {

        try (Workbook workbook = WorkbookFactory.create(new FileInputStream(new File(excelPath)))) {
            return readExcel2ObjectsHandler(workbook, offsetLine, Integer.MAX_VALUE, 0);
        }
    }
1305750
public List<List<String>> readExcel2List(InputStream is, int offsetLine)
            throws IOException, InvalidFormatException {

        try (Workbook workbook = WorkbookFactory.create(is)) {
            return readExcel2ObjectsHandler(workbook, offsetLine, Integer.MAX_VALUE, 0);
        }
    }
641806
public static DeploymentDescriptor fromXml(InputStream inputStream) {
        try {
            Unmarshaller unmarshaller = getContext().createUnmarshaller();
            unmarshaller.setSchema(schema);
            DeploymentDescriptor descriptor = (DeploymentDescriptor) unmarshaller.unmarshal(inputStream);

            return descriptor;
        } catch (Exception e) {
            throw new RuntimeException("Unable to read deployment descriptor from xml", e);
        }
    }
259550
public <T> List<T> readCSV2Objects(String path, Class<T> clazz) {

        try (InputStream is = new FileInputStream(new File(path))) {
            return readCSVByMapHandler(is, clazz);
        } catch (IOException | Excel4JException e) {
            throw new Excel4jReadException("read [" + path + "] CSV Error: ", e);
        }
    }
1020844
public static InputStream fromFile(String filepath) throws FileNotFoundException {
		if(Strings.isValid(filepath)) {
			return fromFile(new File(filepath));
		}
		return null;
	}
2607
public static String[] getXlsxWorksheets(InputStream stream) 
        throws IOException
    {
        XlsxWorkbook workbook = XlsxWorkbook.getWorkbook(stream);
        String[] sheets = workbook.getSheetNames();
        workbook.close();
        return sheets;
    }
139233
public static List<TransformationDescription> getDescriptionsFromXMLInputStream(InputStream fileContent) {
        List<TransformationDescription> desc = new ArrayList<TransformationDescription>();
        try {
            desc = loadDescrtipionsFromXMLInputSource(new InputSource(fileContent), null);
        } catch (Exception e) {
            LOGGER.error("Unable to read the descriptions from input stream. ", e);
        }
        return desc;
    }
1006179
public List<AbstractCounterConfiguration> parseConfigurations(InputStream is) throws XMLStreamException {
      BufferedInputStream input = new BufferedInputStream(is);
      XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(input);
      CounterManagerConfigurationBuilder builder = new CounterManagerConfigurationBuilder(null);
      try {
         reader.require(START_DOCUMENT, null, null);
         reader.nextTag();
         reader.require(START_ELEMENT, null, null);
         Element element = Element.forName(reader.getLocalName());
         switch (element) {
            case COUNTERS: {
               parseCountersElement(reader, builder);
               break;
            }
            default: {
               throw ParseUtils.unexpectedElement(reader);
            }
         }
      } finally {
         reader.close();
      }
      return builder.create().counters();
   }
473346
public static List<String> readLinesWithClasspathOrFilePath(
            String classpathOrFilePath) {
        return getStringListAsOptWithClasspath(classpathOrFilePath)
                .filter(JMPredicate.getGreaterSize(0))
                .orElseGet(() -> JMFiles.readLines(classpathOrFilePath));
    }
968574
public void validateStringWithXmlSchema(String xml, String xmlSchemaPath) throws IOException {
    try {
      URL schemaUrl = this.getClass().getResource(xmlSchemaPath);
      if (schemaUrl == null) {
        throw new IOException("XML schema not found in classpath: " + xmlSchemaPath);
      }
      try (ByteArrayInputStream stream = new ByteArrayInputStream(xml.getBytes("utf-8"))) {
        validateInternal(new StreamSource(stream), schemaUrl);
      }
    } catch (SAXException e) {
      throw new RuntimeException(e);
    }
  }
300838
public XMLResource xml(JSONPathQuery path) throws Exception {
		Object jsonValue = path.eval(this);
		return xml(jsonValue.toString());
	}
189874
@Override
  public String []list(String path) throws IOException
  {
    if (path.startsWith("/")) {
      path = path.substring(1);
    }
    
    if (! path.endsWith("/")) {
      path = path + "/";
    }

    ArrayList<String> names = new ArrayList<>();
    
    try (ZipInputStream zIn = new ZipInputStream(getBacking().openRead())) {
      ZipEntry entry;
      
      while ((entry = zIn.getNextEntry()) != null) {
        String name = entry.getName();

        if (name.startsWith(path)) {
          String tail = name.substring(path.length());
          int p = tail.indexOf('/');
          
          if (p >= 0) {
            tail = tail.substring(0, p);
          }
          
          if (! tail.equals("") && ! names.contains(tail)) {
            names.add(tail);
          }
        }
      }
    }
    
    String []list = new String[names.size()];
    
    names.toArray(list);
    
    return list;
  }
533477
public static FileInputStream getFileInputStream(String filePath) throws Exception {
        FileInputStream localFileInputStream = new FileInputStream(filePath);
        return localFileInputStream;
    }
365030
public static void convertMXML(String path) throws Exception{
		Map<Integer, String> lines = new HashMap<>();
		List<Integer> lineNumbers = new ArrayList<>();
		String actualLine = "";
		int lineNumber = 0;
		File mxmlfile = new File(path);
		try {
			File file = new File(mxmlfile.getAbsolutePath().substring(0,mxmlfile.getAbsolutePath().indexOf('.'))+"sequentialSort.txt");
			FileWriter output = new FileWriter(file, true);
			XMLInputFactory inputFactory = XMLInputFactory.newInstance();
			XMLStreamReader stax = inputFactory.createXMLStreamReader(new StreamSource(new File(path)));
			boolean element = false;
		
			while (stax.hasNext()) {
				switch (stax.next()) {
				case XMLStreamConstants.START_ELEMENT:
					element = stax.getLocalName().equals("WorkflowModelElement");
					if (stax.getLocalName().equals("ProcessInstance")) {
						String id = getID(stax);
						lineNumber = Integer.parseInt(id.substring(id.indexOf("Case")+4));
						lineNumbers.add(lineNumber);
					}
					break;
				case XMLStreamConstants.CDATA:
				case XMLStreamConstants.CHARACTERS:
					if (!stax.isWhiteSpace() && element) {
						actualLine += stax.getText();
					}
					break;
				case XMLStreamConstants.END_ELEMENT:
					if (stax.getLocalName().equals("ProcessInstance")) {
						actualLine += '\n';
						lines.put(lineNumber, actualLine);
						actualLine = "";
					} else if(stax.getLocalName().equals("WorkflowModelElement")){
						actualLine += '	';
					}
				}
			}
			System.out.println(lineNumbers);
			Collections.sort(lineNumbers);
			System.out.println(lineNumbers);
			for(int line: lineNumbers){
//				System.out.println("write line: "+line);
				output.write(lines.get(line));
			}
			output.close();
		} catch (IOException | XMLStreamException | NumberFormatException e) {
			throw new RuntimeException(e);
		}
	}