Reads the given file into a table using default options
Uses converter specified based on given file extension
Use {@link #usingOptions(ReadOptions) usingOptions} to use non-default options
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));
    }
471504
@Override
	public UserProfile convert(File file)
	{
		if(file == null)
			return null;
		
		try
		{
			String text = IO.readFile(file);
			
			if(text == null ||  text.length() == 0)
				return null;
			
			return converter.convert(text);
		}
		catch (IOException e)
		{
			throw new SystemException("Unable to convert file:"+
						file.getAbsolutePath()+" to user profile ERROR:"+e.getMessage(),e);
		}
	}
980896
function readFile (file, options) {
    // return new Promise that will be resolved with data
    return new Promise((resolve, reject) => {
        // create write stream
        this.createReadStream(file, options).then(stream => {
            // create new concat stream that will call back with stream data
            var concatStream = ConcatStream(buffer => {
                // resolve with string if encoding set or buffer
                var data = defined(options) && defined(options.encoding)
                    ? buffer.toString(options.encoding)
                    : buffer
                // resolve with data
                resolve(data)
            })
            // reject on errors
            stream.on('error', reject)
            // pipe read stream to concat stream which will resolve when done
            stream.pipe(concatStream)
        })
        // pass rejection
        .catch(reject)
    })
}
203910
public static String readFile(File file) throws IOException {
        StringBuilder content = new StringBuilder();
        String line;
        try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
            while ((line = reader.readLine()) != null) {
                content.append(line).append("\r\n");
            }
        }
        return content.toString();
    }
1235030
public static void readSourceFileAndWriteDestFile(final String srcfile, final String destFile)
		throws IOException
	{
		try (FileInputStream fis = new FileInputStream(srcfile);
			FileOutputStream fos = new FileOutputStream(destFile);
			BufferedInputStream bis = new BufferedInputStream(fis);
			BufferedOutputStream bos = new BufferedOutputStream(fos);)
		{
			final int availableLength = bis.available();
			final byte[] totalBytes = new byte[availableLength];
			bis.read(totalBytes, 0, availableLength);
			bos.write(totalBytes, 0, availableLength);
		}
	}
519048
public static Properties fromFile(
    final File file)
    throws IOException
  {
    Objects.requireNonNull(file, "File");

    try (InputStream stream = Files.newInputStream(file.toPath())) {
      final Properties p = new Properties();
      p.load(stream);
      return p;
    }
  }
351137
public static Reader newReader(File file)
            throws IOException
    {
        final String fileEncoding = System.getProperty( "file.encoding", "UTF-8" );
        final String greenPepperEncoding = System.getProperty( "greenpepper.file.encoding", fileEncoding );
        return newReader( file, greenPepperEncoding );
    }
984885
private String[] readFile(String fileName) throws IOException {
    ArrayList<String> result = new ArrayList<String>();
    FileReader fReader = new FileReader(fileName);
    BufferedReader bReader = new BufferedReader(fReader);
    while (true) {
      String line = bReader.readLine();
      if (line == null) {
        break;
      }
      result.add(line);
    }
    bReader.close();
    fReader.close();
    return (String[])result.toArray(new String[result.size()]);
  }
574959
function readFileOptions (options, hasCallback) {
    if (!options || (hasCallback && typeof options === 'function')) {
      return { encoding: null, flag: 'r' };
    } else if (typeof options === 'string') {
      return { encoding: options, flag: 'r' };
    } else if (typeof options === 'object') {
      return options;
    } else {
      return null;
    }
  }
1035438
private void read(InputStream is, Table table) throws IOException
   {
      byte[] buffer = new byte[m_definition.getPageSize()];
      while (true)
      {
         int bytesRead = is.read(buffer);
         if (bytesRead == -1)
         {
            break;
         }

         if (bytesRead != buffer.length)
         {
            throw new IOException("Unexpected end of file");
         }

         readPage(buffer, table);
      }
   }
1217111
private void loadCSVFile(TableDefinition tableDef, File file) throws IOException {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), Utils.UTF8_CHARSET))
            ) {
            loadCSVFromReader(tableDef, file.getAbsolutePath(), file.length(), reader);
        }
    }
887546
public ResourceFormatParser getParserForFileExtension(final File file) throws UnsupportedFormatException {
        String extension = getFileExtension(file.getName());
        if (null != extension) {
            return getParserForFileExtension(extension);
        } else {
            throw new UnsupportedFormatException("Could not determine format for file: " + file.getAbsolutePath());
        }
    }
1050039
public static Reader reader(Format type, InputStream in, DefaultReadHandler<?> customDefaultHandler) {
        return reader(type, in, null, customDefaultHandler);
    }
258097
private static String readFile(final String fileName) throws IOException {
    return new String(Files.readAllBytes(Paths.get(fileName)), StandardCharsets.UTF_8);
  }
39873
public InputStreamReader getFileStream(File file, String encoding)
			throws NoSuchPathException, UnmarshalException{
		try {
			return new InputStreamReader(new FileInputStream(file), encoding);
		} catch (FileNotFoundException e) {
			throw new NoSuchPathException(e);
		} catch (UnsupportedEncodingException e){
			throw new UnmarshalException(e);
		}
	}
966374
@Override
	public void readFrom(InputStream is) throws IOException {
		this.currentItem = 0;
		// read from source and write into tempfile
		// open temp file depending on options compressed/encrypted
		OutputStream tempOS = null;
		if ((this.ca != null) || (this.compressTempFile)) {
			tempOS = new FileOutputStream(this.tempFile);
			if (this.ca != null) { // encrypt file if configured
				tempOS = new CipherOutputStream(tempOS, this.ciEncrypt);
			}
			if (this.compressTempFile) { // compress file if configured
				tempOS = new GZIPOutputStream(tempOS, EncryptedCachedDiskStringsTable.compressBufferSize);
			}
		} else { // not encrypted and not compressed: configure a random access file for
					// writing/reading = highest performance
			this.tempRAF = new RandomAccessFile(this.tempFile, "rw");
		}
		// read from source
		// use Stax event reader
		XMLEventReader xer = null;
		try {
			xer = StaxHelper.newXMLInputFactory().createXMLEventReader(this.originalIS);
			while (xer.hasNext()) {
				XMLEvent xe = xer.nextEvent();
				// check if it is a string item (entry in string table)
				if (xe.isStartElement() && xe.asStartElement().getName().getLocalPart().equalsIgnoreCase("si")) {
					String siText = this.parseSIText(xer);
					// add string to temp file
					this.addString(siText, tempOS);
					this.count++;
				}
			}
			// close tempfile
			// make tempFile available as a reader
		} catch (XMLStreamException e) {
			LOG.error("Cannot read original SharedStringTable from document. Exception " + e);
			throw new IOException(e);
		} catch (FormatNotUnderstoodException e) {
			LOG.error("Cannot read properly SharedStringTable from document. Exception " + e);
			throw new IOException(e);
		} finally {
			// close temporary Stream (tempfile should be deleted using the close method of
			// this class and not here)
			if (tempOS != null) {
				tempOS.close();
			}
		}
		// open the input stream towards the temp file
		this.accessTempFile(0L);

	}
1082564
@SuppressWarnings("unchecked")
  private void parseOptionsFromFile(String optionFileName)
    throws ParseException {

    List<String> options = OptionsFileLoader.loadOptions(optionFileName);
    options.addAll(commandLine.getArgList());

    commandLine = cliParser.parse(cliOptions, options.toArray(new String[0]));
  }