Returns an existing workbook object.
@param file The file with the workbook
@return The existing workbook object
@throws IOException if the workbook cannot be opened
508067
public static XlsxWorkbook getWorkbook(File file) throws IOException
    {
        try
        {
            return new XlsxWorkbook(file);
        }
        catch(Docx4JException e)
        {
            if(e.getCause() != null
                && e.getCause() instanceof IOException)
                throw (IOException)e.getCause();
            else
                throw new IOException(e);
        }
    }
1305690
public File newFile(String fileName) throws IOException {
        File file = new File(getRoot(), fileName);
        if (!file.createNewFile()) {
            throw new IOException(
                    "a file with the name \'" + fileName + "\' already exists in the test folder");
        }
        return file;
    }
1057701
public static String readFile( File file ) throws IOException {
        if (!file.exists()) {
            throw new FileNotFoundException("The required projection file is not available: " + file.getAbsolutePath());
        }
        try (BufferedReader br = new BufferedReader(new FileReader(file))) {
            StringBuilder sb = new StringBuilder(200);
            String line;
            while( (line = br.readLine()) != null ) {
                sb.append(line);
                sb.append("\n"); //$NON-NLS-1$
            }
            return sb.toString();
        }
    }
11128
public static List<String> readFileToLinesList( File file ) throws IOException {
        List<String> lines = new ArrayList<>();
        try (BufferedReader br = new BufferedReader(new FileReader(file))) {
            String line;
            while( (line = br.readLine()) != null ) {
                lines.add(line);
            }
            return lines;
        }
    }
1203441
public static Properties loadFile(File file) throws IOException {
		InputStream input = new FileInputStream(file);
		Properties prop = null;
		try {
			prop = load(input);
		} finally {
			IOUtils.close(input);
		}
		return prop;
	}
921985
static public IParserInput getInstance(final File file) throws IOException
    {
        final List<String> args = new ArrayList<>();
        try (BufferedReader reader = new BufferedReader(new FileReader(file)))
        {
            String aConfigLine = null;
            while ((aConfigLine = reader.readLine()) != null)
                if (aConfigLine.length() > 0 && aConfigLine.charAt(0) != '#')
                    args.add(aConfigLine);
        }

        final NamespaceParser parser = new NamespaceParser();
        parser.args = args.toArray(new String[args.size()]);
        return parser;
    }
614099
public static String readTextFile(File file) throws IOException
    {
        //create reader to file (with default encoding)
        InputStream inputStream=new FileInputStream(file);
        Reader reader=IOHelper.createReader(inputStream,null);

        //read text
        String text=IOHelper.readTextStream(reader);
        
        return text;
    }
78906
public static byte[] getFileContents(File file) throws IOException {
    FileInputStream stream = new FileInputStream(file);
    byte[] contents = new byte[(int) file.length()];
    stream.read(contents);
    stream.close();
    return contents;
  }
163286
public OWLOntology loadOntologyFromFile(File file) throws OWLIOException
    {
        try
        {
            return owlOntologyManager.loadOntologyFromOntologyDocument(file);
        } catch (OWLOntologyCreationException ex)
        {
            throw new OWLIOException(ioErrorMsg, ex);
        }
    }
736752
public static boolean createNewFile(File file) throws IOException {
        createFolder(file.getParent());
        return (!file.exists() || file.delete()) && file.createNewFile();
    }
922162
public T addFile(String file) {
    checkNotNull(file, "file");
    builder.files.add(file);
    return self();
  }
1074599
public static String fromFile(File file) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader(file));
        StringBuilder sb = new StringBuilder();
        String line = br.readLine();

        while (line != null) {
            sb.append(line);
            line = br.readLine();
            if (line != null)
                sb.append(System.lineSeparator());
        }

        br.close();
        return sb.toString();
    }
1085644
private byte[] getExcelOutput(FileColumn[] columns, List<String[]> lines) throws IOException
    {
        // Create the workbook
        baos = new ByteArrayOutputStream(1024);
        if(existing != null)
            workbook = Workbook.createWorkbook(format, baos, existing);
        else
            workbook = Workbook.createWorkbook(format, baos);

        workbook.setHeaders(hasHeaders());

        if(append && workbook.getSheet(worksheet) != null)
            workbook.appendToSheet(columns, lines, worksheet);
        else
            workbook.createSheet(columns, lines, worksheet);

        // Write out the workbook to the stream
        workbook.write();
        workbook.close();

        // The contents returned is the byte array
        return baos.toByteArray();
    }
375521
public static Properties load(File file) throws IOException {
        if (file.isFile()) {
            return load(file.toURI().toURL());
        }
        return new Properties();
    }
748863
public static File exists(File file) {
		Validate.notNull(file);
		if(!file.exists())
			throw new ParameterException("\""+file+"\" does not exist!");
		return file;
	}
1149021
public Configuration create(File file) {
        try {
            Configuration configuration;
            InputStream stream = new BufferedInputStream(new FileInputStream(file));
            try {
                configuration = create(stream);
            } finally {
                stream.close();
            }
            return configuration;
        } catch (IOException e) {
            throw new TextProcessorFactoryException(e);
        }
    }
461051
public FileDigestOutputStream openFile(File file) throws IOException
   {
      MessageDigest md;
      try
      {
         md = MessageDigest.getInstance(digestAlgo);
      }
      catch (NoSuchAlgorithmException e)
      {
         LOG.error("Can't wriet using " + digestAlgo + " algorithm, " + e, e);
         throw new IOException(e.getMessage(), e);
      }

      return new FileDigestOutputStream(file, md);
   }