Package org.apache.commons.io.input

Examples of org.apache.commons.io.input.ReversedLinesFileReader


    for (int i = 0; i < numPartitions; i++) {
      String filename = TableScanner.getSavepointFilename(i);
      assertTrue(files.containsKey(filename));

      File file = files.get(filename);
      ReversedLinesFileReader reader = new ReversedLinesFileReader(file);
      String line = reader.readLine();
      // A null line is actually ok, that just means there were no results in that partition's token range this time around
      if (line != null) {
        foundAtLeastOneLine = true;
        UUID savedUuid = UUID.fromString(line);
        assertNotNull(savedUuid);
View Full Code Here


            return null;
          }
          File savepointFile = files.get(TableScanner.getSavepointFilename(i));
          UUID lastUuid;
          try {
            ReversedLinesFileReader reader = new ReversedLinesFileReader(savepointFile);
            try {
              lastUuid = UUID.fromString(reader.readLine());
            } catch (IllegalArgumentException e) {
              logger.error("Error parsing UUID from savepoint file " + TableScanner.getSavepointFilename(i), e);
              return null;
            }
            reader.close();
          } catch (IOException e) {
            logger.error("Error reading savepoint file", e);
            return null;
          }
          out[i] = this.objectMapper.getTokenForId(this.objectType, lastUuid);
View Full Code Here

   *
   * @return history commands
   */
  private String[] filterLogEntry() {
    ArrayList<String> entries = new ArrayList<String>();
    ReversedLinesFileReader reversedReader = null;
    try {
      reversedReader = new ReversedLinesFileReader(new File(getHistoryFileName()), 4096, Charset.forName("UTF-8"));
      int size = 0;
      String line = null;
      while ((line = reversedReader.readLine()) != null) {
        if (!line.startsWith("//")) {
          size++;
          if (size > historySize) {
            break;
          }
View Full Code Here

        PrintWriter out = response.getWriter();

        String[] tail = new String[settings.getLines()];
        File tailFile = settings.getFile();
        if (tailFile.exists()) {
            ReversedLinesFileReader reader = new ReversedLinesFileReader(tailFile);
            for (int i = tail.length - 1; i > 0; i--) {
                String line = reader.readLine();
                if (line == null) {
                    break;
                }
                tail[i] = line;
            }
View Full Code Here

TOP

Related Classes of org.apache.commons.io.input.ReversedLinesFileReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.