Returns the sheets from the given Excel XLSX file.
@param file The file with the name of the XLSX file
@return The sheet names from the XLSX file
@throws IOException if the file cannot be opened
356258
public static String[] getXlsxWorksheets(File file) 
        throws IOException
    {
        XlsxWorkbook workbook = XlsxWorkbook.getWorkbook(file);
        String[] sheets = workbook.getSheetNames();
        workbook.close();
        return sheets;
    }
877928
public T loadXml(File file) {

    FileResource resource = new FileResource(file);
    return loadXml(resource);
  }
1072433
public OdsFileWriterAdapter createWriterAdapter(final File file) throws IOException {
        final NamedOdsDocument document = this.createNamedDocument();
        final ZipUTF8WriterBuilder zipUTF8Writer = ZipUTF8WriterImpl.builder().noWriterBuffer();
        final OdsFileWriterAdapter writerAdapter = OdsFileWriterAdapter
                .create(OdsFileDirectWriter.builder(this.logger, document)
                        .openResult(this.openFile(file)).zipBuilder(zipUTF8Writer).build());
        document.addObserver(writerAdapter);
        document.prepareFlush();
        return writerAdapter;
    }
853917
public static <T> List<T> readExcelToBeans(File file, Class<T> clazz) throws ReadExcelException {
        return XLSReader.readExcelToBeans(file, null, clazz);
    }
1200710
File appendSheet(final List<WorksheetContent> worksheetContents) throws IOException {
        final ImmutableSet<String> worksheetNames = FluentIterable.from(worksheetContents)
                .transform(new Function<WorksheetContent, String>() {
                    @Nullable @Override public String apply(@Nullable final WorksheetContent worksheetContent) {
                        return worksheetContent.getSpec().getSheetName();
                    }
                }).toSet();
        if(worksheetNames.size() < worksheetContents.size()) {
            throw new IllegalArgumentException("Sheet names must have distinct names");
        }
        for (final String worksheetName : worksheetNames) {
            if(worksheetName.length() > 30) {
                throw new IllegalArgumentException(
                        String.format("Sheet name cannot exceed 30 characters (invalid name: '%s')",
                                worksheetName));
            }
        }

        final XSSFWorkbook workbook = new XSSFWorkbook();
        final File tempFile =
                File.createTempFile(ExcelConverter.class.getName(), UUID.randomUUID().toString() + XLSX_SUFFIX);
        final FileOutputStream fos = new FileOutputStream(tempFile);

        for (WorksheetContent worksheetContent : worksheetContents) {
            final WorksheetSpec spec = worksheetContent.getSpec();
            appendSheet(workbook, worksheetContent.getDomainObjects(), spec.getFactory(), spec.getSheetName());
        }
        workbook.write(fos);
        fos.close();
        return tempFile;
    }
11785
public Table file(File file) throws IOException {
	String extension = Files.getFileExtension(file.getCanonicalPath());
	DataReader<?> reader = registry.getReaderForExtension(extension);
	return reader.read(new Source(file));
    }
543908
public static ArrayList<Line> getLinesInTextFile(String encoding, File file) throws IOException {
		ArrayList<Line> lines = new ArrayList<Line>();
		FileInputStream inputStream = new FileInputStream(file);
		InputStreamReader inputReader = null;
		if(encoding != null) {
			inputReader = new InputStreamReader(inputStream, encoding);
		} else {
			inputReader = new InputStreamReader(inputStream);
		}
		//FileReader fileReader = new FileReader(file);
		BufferedReader reader = new BufferedReader(inputReader);
		String line; int count = 0;
		while ((line = reader.readLine()) != null) {
			count++;
			lines.add(new Line(file.getName(), count, line));
		}
		reader.close();
		return lines;
	}
1108027
public static Document getDocument(File file) {
		SAXReader reader = new SAXReader();
		Document document = null;
		try {
			document = reader.read(file);
		} catch (DocumentException e) {
			throw new RuntimeException(e);
		}
		return document;
	}
1269911
public static Properties load(File file) throws IOException {
		FileInputStream input = new FileInputStream(file);
		Properties properties = null;
		try {
			properties = load(input);
		} finally {
			IOUtils.close(input);
		}
		return properties;
	}
648866
protected List<ExcelFile> getExcelFiles() {
		if (excelFiles == null) {
			excelFiles = newArrayListWithCapacity(3);

			for (int i = 0;; ++i) {
				String baseKey = String.format("dataSource.%s.%d", getName(), i);
				String path = configuration.get(baseKey + ".path");
				if (path == null) {
					break;
				}
				String doString = configuration.get(baseKey + ".dataOrientation", "rowbased");
				DataOrientation dataOrientation = DataOrientation.valueOf(doString);

				log.info("Opening Excel file: {}", path);
				ExcelFile file = new ExcelFile(new File(path), dataOrientation, dataFormatter);

				try {
					file.load();
				} catch (InvalidFormatException ex) {
					throw new JFunkException(ex.getMessage(), ex);
				} catch (IOException ex) {
					throw new JFunkException(ex.getMessage(), ex);
				}

				excelFiles.add(file);
			}
		}
		return excelFiles;
	}
58161
public static <T> List<T> handleWorkBookToBeans(Class<T> clazz, File file) throws ReadExcelException {
        List<T> beans = null;
        try {
            Workbook workbook = WorkbookFactory.create(file);
            beans = ReadExcelUtils.handleWorkBookToBeans(clazz, workbook);
            if (workbook != null) {
                workbook.close();
            }
        } catch (Exception e) {
            throw new ReadExcelException(e.getMessage());
        }
        return beans;
    }
182719
public static String file(File file) throws IOException {
        InputStream in = null;
        try {
            in = new FileInputStream(file);
            return stream(in, file.length());
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }
763898
public static List<File> findAllFile(File file) {
        if (file == null || !file.exists()) {
            return Collections.emptyList();
        }

        if (file.isFile()) {
            return Collections.singletonList(file);
        }

        List<File> fileList = new ArrayList<>();
        File[] files = file.listFiles();
        for (File f : files) {
            fileList.addAll(findAllFile(f));
        }

        return fileList;
    }
1203159
public static <T> List<T> readExcelToBeans(File file, Integer scale, Class<T> clazz) throws ReadExcelException {
        List<Map<String, Object>> mapList = XLSReader.readExcelToMapList(file, scale);
        List<T> beans = new ArrayList<T>();
        for (Map<String, Object> map : mapList) {
            T bean = CommonUtils.toBean(map, clazz);
            if (bean != null) {
                beans.add(bean);
            }
        }
        return beans;
    }
1046197
public static Workbook getWorkbook(String filename, InputStream stream) 
        throws IOException
    {
        Workbook ret = null;
        String lowerFilename = filename.toLowerCase();
        if(lowerFilename.endsWith("."+CommonFiles.XLS_EXT))
        {
            ret = XlsWorkbook.getWorkbook(stream);
        }
        else if(lowerFilename.endsWith("."+CommonFiles.XLSX_EXT))
        {
            XlsxWorkbook.initJaxbContexts();
            ret = XlsxWorkbook.getWorkbook(stream);
        }
        return ret;
    }
800453
public Optional<SheetBindingErrors<P>> getBySheetName(final String sheetName) {
        return list.stream()
                .filter(b -> Utils.equals(b.getSheetName(), sheetName))
                .findFirst();
    }
214437
public void readXML(File file) throws IOException, DocumentException {
        project.setCurrentWorkingDirectory(file.getParentFile());
        dataSource = file.getAbsolutePath();
        InputStream in = progessMonitoredInputStream(file, "Loading analysis");
        try {
            readXML(in, file);
        } catch (IOException e) {
            throw newIOException(file, e);
        } catch (DocumentException e) {
            throw new DocumentException("Failing reading " + file, e);
        }
    }