You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by Otis Gospodnetic <ot...@yahoo.com> on 2009/08/07 20:03:25 UTC

FileLineIterable/Iterator

Hello,

Just updated Taste and adjusted my app to the new API.  Stumbled upon FileLineIterator and I'm wondering why we don't have a ctor that just takes File without that boolean - false for most people, probably, so that can be the default?

$ svn diff core/src/main/java/org/apache/mahout/cf/taste/impl/common/
Index: core/src/main/java/org/apache/mahout/cf/taste/impl/common/FileLineIterable.java
===================================================================
--- core/src/main/java/org/apache/mahout/cf/taste/impl/common/FileLineIterable.java     (revision 802085)
+++ core/src/main/java/org/apache/mahout/cf/taste/impl/common/FileLineIterable.java     (working copy)
@@ -35,6 +35,11 @@
   private final boolean skipFirstLine;
 
   /** Creates a {@link FileLineIterable} over a given file, assuming a UTF-8 encoding. */
+  public FileLineIterable(File file) {
+    this(file, Charset.forName("UTF-8"), false);
+  }
+
+  /** Creates a {@link FileLineIterable} over a given file, assuming a UTF-8 encoding. */
   public FileLineIterable(File file, boolean skipFirstLine) {
     this(file, Charset.forName("UTF-8"), skipFirstLine);
   }
Index: core/src/main/java/org/apache/mahout/cf/taste/impl/common/FileLineIterator.java
===================================================================
--- core/src/main/java/org/apache/mahout/cf/taste/impl/common/FileLineIterator.java     (revision 802085)
+++ core/src/main/java/org/apache/mahout/cf/taste/impl/common/FileLineIterator.java     (working copy)
@@ -47,6 +47,16 @@
    * @throws FileNotFoundException if the file does not exist
    * @throws IOException           if the file cannot be read
    */
+  public FileLineIterator(File file) throws IOException {
+    this(file, Charset.forName("UTF-8"), false);
+  }
+
+  /**
+   * Creates a {@link FileLineIterator} over a given file, assuming a UTF-8 encoding.
+   *
+   * @throws FileNotFoundException if the file does not exist
+   * @throws IOException           if the file cannot be read
+   */
   public FileLineIterator(File file, boolean skipFirstLine) throws IOException {
     this(file, Charset.forName("UTF-8"), skipFirstLine);
   }

Otis
--
Sematext is hiring -- http://sematext.com/about/jobs.html?mls
Lucene, Solr, Nutch, Katta, Hadoop, HBase, UIMA, NLP, NER, IR


Re: FileLineIterable/Iterator

Posted by Sean Owen <sr...@gmail.com>.
No prob I can add that. Most reasonble. Or you are welcome to add it, whatev.

On Fri, Aug 7, 2009 at 7:03 PM, Otis
Gospodnetic<ot...@yahoo.com> wrote:
> Hello,
>
> Just updated Taste and adjusted my app to the new API.  Stumbled upon FileLineIterator and I'm wondering why we don't have a ctor that just takes File without that boolean - false for most people, probably, so that can be the default?