Examples of LineIterator


Examples of com.baulsupp.kolja.log.line.LineIterator

    }
  }

  public void process(File file, IntRange intRange) throws Exception {

    LineIterator lineIterator;
    if (requiresRandomAccess()) {
      LineIndex li = lineIndexFactory.buildLineIndex(file, format);

      if (showRequests) {
        RequestIndex requestIndex = format.getRequestIndex(li);
View Full Code Here

Examples of com.baulsupp.kolja.log.line.LineIterator

  }

  public void process(File file, LongRange intRange) throws Exception {
    log.info("Processing file " + intRange);

    LineIterator lineIterator;
    if (requiresRandomAccess()) {
      LineIndex li = lineIndexFactory.buildLineIndex(file, format);

      if (showRequests) {
        RequestIndex requestIndex = format.getRequestIndex(li);
View Full Code Here

Examples of com.ds.http.processor.util.LineIterator

    private HttpRequest parseConnection() throws IOException {
        System.out.println("Extract request from connection");
        HttpRequest httpRequest = new HttpRequest();

        String line = connection.readLine();
        LineIterator lineIterator = new LineIterator(line);
        httpRequest.setMethod(HttpMethod.valueOf(lineIterator.next()));
        httpRequest.setURI(lineIterator.next());
        httpRequest.setHttpVersion(lineIterator.next());

        Map<String, String> headers = new HashMap<String, String>();
        String nextLine = "";
        while (!(nextLine = connection.readLine()).equals("")) {
            String values[] = nextLine.split(":", 2);
View Full Code Here

Examples of com.sissi.commons.apache.LineIterator

    ByteArrayOutputStream source = new ByteArrayOutputStream();
    BufferedOutputStream buffer = new BufferedOutputStream(source);
    try {
      marshaller.marshal(node, buffer);
      buffer.flush();
      LineIterator iterator = IOUtil.lineIterator(new ByteArrayInputStream(source.toByteArray()), "UTF-8");
      LinkedList<String> contents = new LinkedList<String>();
      while (iterator.hasNext()) {
        String each = iterator.next().trim();
        if (!each.isEmpty()) {
          contents.add(each);
        }
      }
      return contents;
View Full Code Here

Examples of gnu.inet.nntp.LineIterator

        // TODO start a thread to get list of articles
        Thread t = new Thread() {
            // get first connection
            private NNTPConnection con = usedConnections.get(0);
            public void run() {
                LineIterator ait;
                try {
                    ait = con.newNews(group.getName(), group.getLastUpdate(), null);
                    System.out.println("NEW NEWS: ");
                    while(ait.hasNext()) {
                        //TODO get new articles for this group
                        System.out.println(ait.nextLine());
                    }
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
View Full Code Here

Examples of gnu.inet.nntp.LineIterator

        // TODO start a thread to get list of articles
        Thread t = new Thread() {
            // get first connection
            private NNTPConnection con = usedConnections.get(0);
            public void run() {
                LineIterator lit;
                try {
                    lit = con.newGroups(date, null);
                    System.out.println("NEW NEWS: ");
                    while(lit.hasNext()) {
                        //TODO get new groups
                        System.out.println(lit.nextLine());
                        //TODO fire NewGroupEvent
                    }
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
View Full Code Here

Examples of htsjdk.tribble.readers.LineIterator

    public MUTCodec(String path, Genome genome) {
        super(Mutation.class);
        this.path = path;
        this.genome = genome;
        try {
            LineIterator reader = new LineIteratorImpl(new AsciiLineReader(ParsingUtils.openInputStream(path)));
            readActualHeader(reader);
        } catch (IOException e) {
            log.error(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of it.unimi.dsi.io.LineIterator

    final Collection<? extends CharSequence> collection;
    if ( termFile == null ) {
      ArrayList<MutableString> termList = new ArrayList<MutableString>();
      final ProgressLogger pl = new ProgressLogger();
      pl.itemsName = "URIs";
      final LineIterator termIterator = new LineIterator( new FastBufferedReader( new InputStreamReader( System.in, "UTF-8" ), bufferSize ), pl );
     
      pl.start( "Reading URIs..." );
      MutableString uri;
      while( termIterator.hasNext() ) {
        uri = termIterator.next();
        if ( uniqueURIs ) makeUnique( filter, uri );
        termList.add( uri.copy() );
      }
      pl.done();
     
      collection = termList;
    }
    else {
      if ( uniqueURIs ) {
        // Create temporary file with unique URIs
        final ProgressLogger pl = new ProgressLogger();
        pl.itemsName = "URIs";
        pl.start( "Copying URIs..." );
        final LineIterator termIterator = new LineIterator( new FastBufferedReader( new InputStreamReader( new FileInputStream( termFile ) ), bufferSize ), pl );
        File temp = File.createTempFile( URLMPHVirtualDocumentResolver.class.getName(), ".uniqueuris" );
        temp.deleteOnExit();
        termFile = temp.toString();
        final FastBufferedOutputStream outputStream = new FastBufferedOutputStream( new FileOutputStream( termFile ), bufferSize );
        MutableString uri;
        while( termIterator.hasNext() ) {
          uri = termIterator.next();
          makeUnique( filter, uri );
          uri.writeUTF8( outputStream );
          outputStream.write( '\n' );
        }
        pl.done();
View Full Code Here

Examples of org.apache.commons.io.LineIterator

        // maintain the ordering in the file. Line N in the host names file
        // should correspond to node ID N-1. Previously they were in hashed
        // order, so certain tools that auto-configure a cluster based on
        // this same hosts file were creating invalid configurations between
        // the cluster.xml and server.properties (node.id) files.
        LineIterator li = null;
        int lineNumber = 0;

        try {
            li = FileUtils.lineIterator(file);

            while(li.hasNext()) {
                String rawLine = String.valueOf(li.next()).trim();
                lineNumber++;

                // Strip comments
                int hashIndex = rawLine.indexOf("#");

                if(hashIndex != -1)
                    rawLine = rawLine.substring(0, hashIndex).trim();

                // Whitespace
                if(rawLine.length() == 0)
                    continue;

                String[] line = StringUtils.split(rawLine, " \t=:");

                if(line.length < 1 || line.length > 2) {
                    System.err.println("Invalid entry (line " + lineNumber + ") in "
                                       + file.getAbsolutePath() + ": " + rawLine);
                    System.exit(2);
                }

                String externalHostName = line[0];
                String internalHostName = line.length > 1 ? line[1] : externalHostName;
                hostNamePairs.add(new HostNamePair(externalHostName, internalHostName));
            }
        } catch(IOException e) {
            throw new RuntimeException(e);
        } finally {
            if(li != null)
                li.close();
        }

        return hostNamePairs;
    }
View Full Code Here

Examples of org.apache.commons.io.LineIterator

  public void index() throws IOException {
    final SimpleIndexer indexer = new SimpleIndexer(indexDir);
    try {
      int counter = 0;
      final LineIterator it = FileUtils.lineIterator(BNB_PATH);
      while (it.hasNext()) {
        final String id = Integer.toString(counter++);
        final String content = (String) it.next();
        logger.info("Indexing document {}", id);
        indexer.addDocument(id, content);
      }
      LineIterator.closeQuietly(it);
      logger.info("Commiting all pending documents");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.