org.apache.hadoop.streaming
Class StreamUtil
java.lang.Object
org.apache.hadoop.streaming.StreamUtil
public class StreamUtil
- extends Object
Utilities not available elsewhere in Hadoop.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StreamUtil
public StreamUtil()
goodClassOrNull
public static Class goodClassOrNull(Configuration conf,
String className,
String defaultPackage)
- It may seem strange to silently switch behaviour when a String
is not a classname; the reason is simplified Usage:
-mapper [classname | program ]
instead of the explicit Usage:
[-mapper program | -javamapper classname], -mapper and -javamapper are mutually exclusive.
(repeat for -reducer, -combiner)
findInClasspath
public static String findInClasspath(String className)
findInClasspath
public static String findInClasspath(String className,
ClassLoader loader)
- Returns:
- a jar file path or a base directory or null if not found.
dfmt
public static String dfmt(double d)
ifmt
public static String ifmt(double d)
formatBytes
public static String formatBytes(long numBytes)
formatBytes2
public static String formatBytes2(long numBytes)
regexpEscape
public static String regexpEscape(String plain)
safeGetCanonicalPath
public static String safeGetCanonicalPath(File f)
rjustify
public static String rjustify(String s,
int width)
ljustify
public static String ljustify(String s,
int width)
getSpace
public static String getSpace(int len)
makeJavaCommand
public static String makeJavaCommand(Class main,
String[] argv)
collate
public static String collate(Object[] args,
String sep)
collate
public static String collate(List args,
String sep)
getCurrentSplit
public static FileSplit getCurrentSplit(JobConf job)
isLocalJobTracker
public static boolean isLocalJobTracker(JobConf job)
getTaskInfo
public static org.apache.hadoop.streaming.StreamUtil.TaskId getTaskInfo(JobConf job)
touch
public static void touch(File file)
throws IOException
- Throws:
IOException
isCygwin
public static boolean isCygwin()
localizeBin
public static String localizeBin(String path)
getBoundAntProperty
public static String getBoundAntProperty(String name,
String defaultVal)
- Parameters:
name
- foo where <junit><sysproperty key="foo" value="${foo}"/>
If foo is undefined then Ant sets the unevaluated value.
Take this into account when setting defaultVal.
Copyright © 2009 The Apache Software Foundation