org.apache.mahout.common
Class FileLineIterable

java.lang.Object
  extended by org.apache.mahout.common.FileLineIterable
All Implemented Interfaces:
java.lang.Iterable<java.lang.String>

public final class FileLineIterable
extends java.lang.Object
implements java.lang.Iterable<java.lang.String>

Iterable representing the lines of a text file. It can produce an Iterator over those lines. This assumes the text file's lines are delimited in a manner consistent with how BufferedReader defines lines. This class will uncompress files that end in .zip or .gz accordingly, too.


Constructor Summary
FileLineIterable(java.io.File file)
          Creates a over a given file, assuming a UTF-8 encoding.
FileLineIterable(java.io.File file, boolean skipFirstLine)
          Creates a over a given file, assuming a UTF-8 encoding.
FileLineIterable(java.io.File file, java.nio.charset.Charset encoding, boolean skipFirstLine)
          Creates a over a given file, using the given encoding.
FileLineIterable(java.io.InputStream is)
           
FileLineIterable(java.io.InputStream is, boolean skipFirstLine)
           
FileLineIterable(java.io.InputStream is, java.nio.charset.Charset encoding, boolean skipFirstLine)
           
 
Method Summary
 java.util.Iterator<java.lang.String> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileLineIterable

public FileLineIterable(java.io.File file)
                 throws java.io.IOException
Creates a over a given file, assuming a UTF-8 encoding.

Throws:
java.io.IOException

FileLineIterable

public FileLineIterable(java.io.File file,
                        boolean skipFirstLine)
                 throws java.io.IOException
Creates a over a given file, assuming a UTF-8 encoding.

Throws:
java.io.IOException

FileLineIterable

public FileLineIterable(java.io.File file,
                        java.nio.charset.Charset encoding,
                        boolean skipFirstLine)
                 throws java.io.IOException
Creates a over a given file, using the given encoding.

Throws:
java.io.IOException

FileLineIterable

public FileLineIterable(java.io.InputStream is)

FileLineIterable

public FileLineIterable(java.io.InputStream is,
                        boolean skipFirstLine)

FileLineIterable

public FileLineIterable(java.io.InputStream is,
                        java.nio.charset.Charset encoding,
                        boolean skipFirstLine)
Method Detail

iterator

public java.util.Iterator<java.lang.String> iterator()
Specified by:
iterator in interface java.lang.Iterable<java.lang.String>


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.