|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrecognizer.Utils
public class Utils
Library of program-independent static methods.
| Constructor Summary | |
|---|---|
Utils()
|
|
| Method Summary | |
|---|---|
static int |
countMatches(java.lang.String regex,
java.lang.String text)
Counts the number of times a pattern appears in a string. |
static void |
printHash(java.util.Hashtable<? extends java.lang.Object,? extends java.lang.Object> ht,
java.io.PrintStream out)
Prints the content of a hashtable containing strings to the standard output. |
static void |
printMap(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> map,
java.io.PrintStream out)
Prints the content of a Map containing strings to the standard output. |
static java.lang.String |
readDir(java.io.File dir)
Reads the content of all files in a directory into a single string. |
static java.lang.String |
readFile(java.io.File file)
Reads the content of a text file into a string. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Utils()
| Method Detail |
|---|
public static int countMatches(java.lang.String regex,
java.lang.String text)
regex - regular expression string to be matched, it must be in the
appropriate format to be compiled into a Pattern object.text - input text.
public static void printHash(java.util.Hashtable<? extends java.lang.Object,? extends java.lang.Object> ht,
java.io.PrintStream out)
throws java.lang.Exception
ht - hashtable with string keys and values that can be represented
using their toString() method.out - output stream.
java.lang.Exception
public static void printMap(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> map,
java.io.PrintStream out)
throws java.lang.Exception
map - map with string keys and values that can be represented
using their toString() method.out - output stream.
java.lang.Exception
public static java.lang.String readFile(java.io.File file)
throws java.lang.Exception
file - text file.
java.lang.Exception
public static java.lang.String readDir(java.io.File dir)
throws java.lang.Exception
dir - directory containing text files.
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||