Package org.apache.commons.io

Examples of org.apache.commons.io.LineIterator


    ClientResponse response = dockerClient.build(baseDir);

    StringWriter logwriter = new StringWriter();

    try {
      LineIterator itr = IOUtils.lineIterator(
          response.getEntityInputStream(), "UTF-8");
      while (itr.hasNext()) {
        String line = itr.next();
        logwriter.write(line + "\n");
        LOG.info(line);
      }
    } finally {
      IOUtils.closeQuietly(response.getEntityInputStream());
View Full Code Here


    ClientResponse response = dockerClient.build(baseDir);

    StringWriter logwriter = new StringWriter();

    try {
      LineIterator itr = IOUtils.lineIterator(
          response.getEntityInputStream(), "UTF-8");
      while (itr.hasNext()) {
        String line = itr.next();
        logwriter.write(line + "\n");
        LOG.info(line);
      }
    } finally {
      IOUtils.closeQuietly(response.getEntityInputStream());
View Full Code Here

    if (!aReportFile.exists()) {
      // Ignore if the file is missing
      return;
    }

    LineIterator i = null;
    try {
      String clazz = null;
      i = IOUtils.lineIterator(new FileInputStream(aReportFile), encoding);
      while (i.hasNext()) {
        String line = i.next();
        // Report say there is no missing meta data
        if (line.startsWith(MARK_NO_MISSING_META_DATA)) {
          return;
        }
        // Line containing class name
View Full Code Here

   */
  public static String asString(ClientResponse response) throws IOException {

    StringWriter out = new StringWriter();
    try {
      LineIterator itr = IOUtils.lineIterator(
          response.getEntityInputStream(), "UTF-8");
      while (itr.hasNext()) {
        String line = itr.next();
        out.write(line + (itr.hasNext() ? "\n" : ""));
      }
    } finally {
      closeQuietly(response.getEntityInputStream());
    }
    return out.toString();
View Full Code Here

        state = State.SWEEPING;
        LOG.debug("Starting sweep phase of the garbage collector");

        ConcurrentLinkedQueue<String> exceptionQueue = new ConcurrentLinkedQueue<String>();

        LineIterator iterator =
                FileUtils.lineIterator(fs.getGcCandidates(), Charsets.UTF_8.name());
        List<String> ids = Lists.newArrayList();

        while (iterator.hasNext()) {
            ids.add(iterator.next());

            if (ids.size() > getBatchCount()) {
                count += ids.size();
                executor.execute(new Sweeper(ids, exceptionQueue));
                ids = Lists.newArrayList();
View Full Code Here

    }

    private static LineIterator lineItr(String seq) {
        Iterable<String> seqItr = Splitter.on(',').trimResults().split(seq);
        String lines = Joiner.on(StandardSystemProperty.LINE_SEPARATOR.value()).join(seqItr);
        return new LineIterator(new StringReader(lines));
    }
View Full Code Here

    protected Map<String, String> getMigrateMap() throws IOException {
        Map<String,String> map = new HashMap<String,String>();
        InputStream inStream = getClass().getResourceAsStream(
                "/org/archive/crawler/migrate/H1toH3.map");
        LineIterator iter = IOUtils.lineIterator(inStream, "UTF-8");
        while(iter.hasNext()) {
            String[] fields = iter.nextLine().split("\\|");
            map.put(fields[1], fields[0]);
        }
        inStream.close();
        return map;
    }
View Full Code Here

    ArrayList<String> result = new ArrayList<String>();
    for (File file : getCluster().getConfig().getLogDir().listFiles()) {
      // We want to grab the files called .out
      if (file.getName().contains(".out") && file.isFile() && file.canRead()) {
        LineIterator it = FileUtils.lineIterator(file, Constants.UTF8.name());
        try {
          while (it.hasNext()) {
            String line = it.nextLine();
            if (line.matches(".* \\[" + AuditedSecurityOperation.AUDITLOG + "\\s*\\].*")) {
              // Only include the message if startTimestamp is null. or the message occurred after the startTimestamp value
              if ((lastAuditTimestamp == null) || (line.substring(0, 23).compareTo(lastAuditTimestamp) > 0))
                result.add(line);
            }
View Full Code Here

    auditConnector.tableOperations().exportTable(OLD_TEST_TABLE_NAME, exportDir.toString());

    // We've exported the table metadata to the MiniAccumuloCluster root dir. Grab the .rf file path to re-import it
    File distCpTxt = new File(exportDir.toString() + "/distcp.txt");
    File importFile = null;
    LineIterator it = FileUtils.lineIterator(distCpTxt, Constants.UTF8.name());

    // Just grab the first rf file, it will do for now.
    String filePrefix = "file:";
    try {
      while (it.hasNext() && importFile == null) {
        String line = it.nextLine();
        if (line.matches(".*\\.rf")) {
          importFile = new File(line.replaceFirst(filePrefix, ""));
        }
      }
    } finally {
View Full Code Here

    URL resource = getClass().getResource( RESOURCE_NAME_DE_PLZ_TXT );
    if ( resource == null ) {
      throw new IOException( "Resource \"" + RESOURCE_NAME_DE_PLZ_TXT + "\" not found" );
    }

    LineIterator iterator = IOUtils.lineIterator( resource.openStream(), "UTF-8" );
    while ( iterator.hasNext() ) {
      String line = iterator.nextLine();
      String[] parts = line.split( "\t" );
      if ( parts.length == 0 ) {
        continue;
      }
View Full Code Here

TOP

Related Classes of org.apache.commons.io.LineIterator

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.