org.apache.mahout.classifier.df
Class DFUtils

java.lang.Object
  extended by org.apache.mahout.classifier.df.DFUtils

public final class DFUtils
extends Object

Utility class that contains various helper methods


Method Summary
static String elapsedTime(long milli)
          Formats a time interval in milliseconds to a String in the form "hours:minutes:seconds:millis"
static org.apache.hadoop.fs.Path[] listOutputFiles(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path outputPath)
          Return a list of all files in the output directory
static double[] readDoubleArray(DataInput in)
          Reads a double[] from a DataInput
static int[] readIntArray(DataInput in)
          Reads an int[] from a DataInput
static Node[] readNodeArray(DataInput in)
          Reads a Node[] from a DataInput
static void storeString(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path path, String string)
          Write a string to a path.
static void storeWritable(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path path, org.apache.hadoop.io.Writable writable)
           
static void writeArray(DataOutput out, double[] array)
          Writes a double[] into a DataOutput
static void writeArray(DataOutput out, int[] array)
          Writes an int[] into a DataOutput
static void writeArray(DataOutput out, Node[] array)
          Writes an Node[] into a DataOutput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeArray

public static void writeArray(DataOutput out,
                              Node[] array)
                       throws IOException
Writes an Node[] into a DataOutput

Throws:
IOException

readNodeArray

public static Node[] readNodeArray(DataInput in)
                            throws IOException
Reads a Node[] from a DataInput

Throws:
IOException

writeArray

public static void writeArray(DataOutput out,
                              double[] array)
                       throws IOException
Writes a double[] into a DataOutput

Throws:
IOException

readDoubleArray

public static double[] readDoubleArray(DataInput in)
                                throws IOException
Reads a double[] from a DataInput

Throws:
IOException

writeArray

public static void writeArray(DataOutput out,
                              int[] array)
                       throws IOException
Writes an int[] into a DataOutput

Throws:
IOException

readIntArray

public static int[] readIntArray(DataInput in)
                          throws IOException
Reads an int[] from a DataInput

Throws:
IOException

listOutputFiles

public static org.apache.hadoop.fs.Path[] listOutputFiles(org.apache.hadoop.fs.FileSystem fs,
                                                          org.apache.hadoop.fs.Path outputPath)
                                                   throws IOException
Return a list of all files in the output directory

Throws:
IOException - if no file is found

elapsedTime

public static String elapsedTime(long milli)
Formats a time interval in milliseconds to a String in the form "hours:minutes:seconds:millis"


storeWritable

public static void storeWritable(org.apache.hadoop.conf.Configuration conf,
                                 org.apache.hadoop.fs.Path path,
                                 org.apache.hadoop.io.Writable writable)
                          throws IOException
Throws:
IOException

storeString

public static void storeString(org.apache.hadoop.conf.Configuration conf,
                               org.apache.hadoop.fs.Path path,
                               String string)
                        throws IOException
Write a string to a path.

Parameters:
conf - From which the file system will be picked
path - Where the string will be written
string - The string to write
Throws:
IOException - if things go poorly


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.