home | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (StreamLineIteratorTest.java)

This example Java source code file (StreamLineIteratorTest.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

classpathresource, exception, file, fileinputstream, logger, streamlineiteratortest, string, test

The StreamLineIteratorTest.java Java example source code

package org.deeplearning4j.text.sentenceiterator;

import org.canova.api.util.ClassPathResource;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.FileInputStream;

import static org.junit.Assert.*;

 * Created by fartovii on 09.11.15.
public class StreamLineIteratorTest {

    protected Logger logger = LoggerFactory.getLogger(StreamLineIteratorTest.class);

    public void testHasNext() throws Exception {

        ClassPathResource reuters5250 = new ClassPathResource("/reuters/5250");
        File f = reuters5250.getFile();

        StreamLineIterator iterator = new StreamLineIterator.Builder(new FileInputStream(f))

        int cnt = 0;
        while (iterator.hasNext()) {
            String line = iterator.nextSentence();

            assertNotEquals(null, line);
            logger.info("Line: " + line);

        assertEquals(24, cnt);

Other Java examples (source code examples)

Here is a short list of links related to this Java StreamLineIteratorTest.java source code file:

my book on functional programming


new blog posts


Copyright 1998-2019 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.