Load a new log file into this reader.
@param logFile the log file to load.
@return A future that resolves to the sparkey reader once it has loaded the new log file.
483743
public CompletionStage<ReloadableSparkeyReader> load(final File logFile) {
    checkArgument(isValidLogFile(logFile));
    CompletableFuture<ReloadableSparkeyReader> result = new CompletableFuture<>();
    this.executorService.submit(() -> {
      switchReader(logFile);
      result.complete(this);
    });
    return result;
  }
672991
public static synchronized XMLEventReader createFileReader(final File paramFile) throws IOException,
        XMLStreamException {
        final XMLInputFactory factory = XMLInputFactory.newInstance();
        factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
        final InputStream in = new FileInputStream(paramFile);
        return factory.createXMLEventReader(in);
    }
1185198
public static ObjectStream<String> readFileIntoMarkableStreamFactory(
      final String infile) {

    InputStreamFactory inputStreamFactory = null;
    try {
      inputStreamFactory = new MarkableFileInputStreamFactory(new File(infile));
    } catch (final FileNotFoundException e) {
      e.printStackTrace();
    }
    ObjectStream<String> lineStream = null;
    try {
      lineStream = new PlainTextByLineStream(inputStreamFactory, "UTF-8");
    } catch (final IOException e) {
      CmdLineUtil.handleCreateObjectStreamError(e);
    }
    return lineStream;
  }
332931
def read(self, log_file):
        
        if os.path.isdir(os.path.dirname(log_file)) and os.path.isfile(log_file):
            with open(log_file, 'r') as LogFile:
                data = LogFile.readlines()
                data = "".join(line for line in data)
        else:
            data = ''
        return data
1177160
public void addChangeLog(File changelogFile) throws IOException, ChangelogParseException {
		// parse the change log to a list of entries
		InputStream changelog = new FileInputStream(changelogFile);
		ChangelogParser parser = new ChangelogParser();
		List<ChangelogEntry> entries = parser.parse(changelog);
		for (ChangelogEntry entry : entries) {
			addChangeLogEntry(entry);
		}
	}
1102380
protected void loadDataFromFile(File definitionFile) throws IOException {
		PHPFileParser fp = new PHPFileParser(definitionFile);
		createInternalDataStructre(fp.getSections());
	}
479440
public void load(String file) {
		Context context = factory.enterContext();
		
		try {
			URL url = Thread.currentThread().getContextClassLoader().getResource(file);
			
			if (url == null) {
				logger.debug("Configuration [" + file + "] does not exist");
				return;
			}
			
			File f = new File(url.getPath());
			
			if (f.exists()) {
				logger.info("Loading configuration [" + file + "]");
				context.evaluateReader(scope, new FileReader(f), file.substring(file.lastIndexOf("/") + 1), 1, null);
			}
			
		} catch (Exception e) {
			logger.error("Failed to load configuration [" + file + "]", e);
			throw new UncheckedException(e);
		} finally {
			Context.exit();
		}
	}
728113
private void openInputStream(File txFile) throws IOException {
    int ioExceptionRetryCount = 0, logHeaderCorruptRetryCount = 0;
    
    LOG.info("Trying to load the edit log from " + txFile.getAbsolutePath());
    
    do {
      try {
        inputStream = new EditLogFileInputStream(txFile);
        editLogFilePosition = inputStream.getPosition();
        curStreamConsumed = false;
        curStreamFinished = false;
        readNullAfterStreamFinished = false;
        LOG.info("Successfully loaded the edits log from " +
            txFile.getAbsolutePath());
        break;
        
      } catch (LogHeaderCorruptException e1) {
        if (logHeaderCorruptRetryCount == LOG_HEADER_CORRUPT_RETRY_MAX) {
          LOG.error("Failed to load the edit log. No retries left.", e1);
          throw new IOException("Could not load the edit log");
        }
        logHeaderCorruptRetryCount ++;
        LOG.warn("Failed to load the edit log. Retry " +
            logHeaderCorruptRetryCount + " ...", e1);
        try {
          Thread.sleep(ioExceptionRetryCount * LOG_HEADER_CORRUPT_BASE_SLEEP);
        } catch (InterruptedException e) {
          throw new IOException(e);
        }
        
      } catch (IOException e2) {
        if (ioExceptionRetryCount == IO_EXCEPTION_RETRY_MAX) {
          LOG.error("Failed to load the edit log. No retries left.", e2);
          throw new IOException("Could not load the edit log");
        }
        ioExceptionRetryCount ++;
        LOG.warn("Failed to load the edit log. Retry " +
            ioExceptionRetryCount + " ...", e2);
        try {
          Thread.sleep(ioExceptionRetryCount * IO_EXCEPTION_BASE_SLEEP);
        } catch (InterruptedException e) {
          throw new IOException(e);
        }
      }
      
    } while (true);
  }
802521
public static LogView parse(File file) throws IOException {
                LogView view = (LogView) xstream.fromXML(file);
                view.reinitialize();
                return view;
        }
919765
public Engine fromFile(File file) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                new FileInputStream(file), FuzzyLite.UTF_8));
        String line;
        StringBuilder textEngine = new StringBuilder();
        try {
            while ((line = reader.readLine()) != null) {
                textEngine.append(line).append("\n");
            }
        } catch (IOException ex) {
            throw ex;
        } finally {
            reader.close();
        }
        return fromString(textEngine.toString());
    }
570040
protected LinkedHashMap<Pattern, String> load(File propertyFile) {
    LinkedHashMap<Pattern, String> result = new LinkedHashMap<Pattern, String>();
    BufferedReader reader = null;
    try {
      reader =
          new BufferedReader(new InputStreamReader(new FileInputStream(propertyFile), "UTF-8"));
      String line;
      while ((line = reader.readLine()) != null) {
        if (line.length() == 0) {
          continue;
        }
        char firstChar = line.charAt(0);
        if (firstChar == '#' || firstChar == '!') {
          continue;
        }
        int pos = line.indexOf('=');
        if (pos < 0) {
          continue;
        }
        String key = line.substring(0, pos);
        String value = line.substring(pos + 1, line.length());
        int pos2 = line.indexOf('@');
        if (pos2 == 0) {
          key = key.substring(1);
        } else if (pos2 > 0) {
          key = Pattern.quote(key.substring(0, pos2)) + key.substring(pos2);
        }
        result.put(Pattern.compile(key), value);
      }
    } catch (IOException e) {
      throw new GenException(Message.DOMAGEN9001, e, e);
    } finally {
      IOUtil.close(reader);
    }
    return result;
  }
1026451
private LogRecordWithInputStream nextLogRecord() throws IOException {
    try {
      return nextLogRecord(reader);
    } catch (EndOfStreamException e) {
      eos = true;
      LOG.info(()->"end of stream is reached");
      return null;
    }
  }
179850
def setup_logfile(self, logfile, mode='w'):
        ''''''
        self.logfile = open(logfile, mode=mode)
1338256
private FileReader createFileReader(Path file)
          throws IOException {
    if(readerType.equalsIgnoreCase(Configs.SEQ)) {
      return new SequenceFileReader(this.hdfs, file, conf);
    }
    if(readerType.equalsIgnoreCase(Configs.TEXT)) {
      return new TextFileReader(this.hdfs, file, conf);
    }
    try {
      Class<?> clsType = Class.forName(readerType);
      Constructor<?> constructor = clsType.getConstructor(FileSystem.class, Path.class, Map.class);
      return (FileReader) constructor.newInstance(this.hdfs, file, conf);
    } catch (Exception e) {
      LOG.error(e.getMessage(), e);
      throw new RuntimeException("Unable to instantiate " + readerType + " reader", e);
    }
  }
1326580
public List<RawPacket> startBinlogDump(final int position, final String logfile) throws SQLException {
        try {
            return this.protocol.startBinlogDump(position, logfile);
        } catch (BinlogDumpException e) {
            throw SQLExceptionMapper.getSQLException("Could not dump binlog", e);
        }
    }
366138
Observable<File> mergeLogs(@NonNull File mergedFile) {

        return Observable.fromCallable(() -> {
            synchronized (sharedLock) {
                try {
                    mergeFiles(mergedFile);
                } catch (Exception e) {
                    e.printStackTrace();
                } finally {
                    sharedLock.notifyAll();
                }
            }
            return mergedFile;
        }).subscribeOn(Schedulers.from(executor));
    }
688350
private static void log(File logFile, long connectionId, char separator, String line) {
		synchronized(logFile) {
			try {
				try (Writer out = new FileWriter(logFile, true)) {
					out.write(Long.toString(connectionId));
					out.write(separator);
					out.write(' ');
					out.write(line);
					out.write('\n');
				}
			} catch(IOException e) {
				e.printStackTrace(System.err);
			}
		}
	}