futils
Class ReaderUtil

java.lang.Object
  extended by futils.ReaderUtil

public class ReaderUtil
extends java.lang.Object


Constructor Summary
ReaderUtil()
           
 
Method Summary
static void close(java.io.BufferedReader br)
          "@param br
static void close(java.io.FileReader fr)
           
static int countTokens(java.io.BufferedReader br)
          Prompts the user for a file and counts the tokens.
static SimpleAddressBook getAddressBook()
          Obtain a list of records using a given record delimiter.
static SimpleAddressBook getAddressBook(java.io.File f, java.lang.String c)
          Do a getRecords with
static boolean getBoolean(java.lang.String prompt)
           
static java.io.BufferedReader getBufferedReader(java.io.File f)
          "@param f
static java.io.BufferedReader getBufferedReader(java.lang.String prompt)
          "@param prompt
static byte[] getBytes(int i)
           
static byte[] getBytes(java.lang.String[] o)
           
static double getDouble(java.lang.String prompt)
           
static java.lang.String getFileAsOneBigString(java.io.File f)
          Returns the file instance as a string, reading it in, one line affineTransform a time.
static java.lang.String[] getFileAsStringArray(java.io.File f)
          Reads in a text file
static java.io.FileReader getFileReader(java.io.File file)
           
static java.io.FileReader getFileReader(java.lang.String prompt)
           
static int[] getInt(byte[] b)
           
static int getInt(java.lang.String prompt)
           
static int[] getInts(float f)
           
static java.io.BufferedReader getReader()
           
static java.lang.String getString(java.lang.String prompt)
           
static java.lang.String[] getTokens(java.lang.String s)
           
static boolean isReadableFile(java.io.File f)
          isReadableFile() - validates the file is exists and readable
static void listFile()
           
static void listFilteredHrefFile(java.io.File file)
           
static void main(java.lang.String[] args)
           
static boolean parseBoolean(java.lang.String s)
           
static void print(int[] o)
           
static void print(java.lang.Object[] o)
           
static void readDataFile(java.io.File file, double[] data)
           
static java.lang.String readLine(java.io.BufferedReader br)
           
static void readQuestion(java.lang.String s)
           
static void setReader(java.io.BufferedReader _br)
           
static int[] string2Int(java.lang.String[] s)
           
static int sum(int[] o)
           
static void testGetFile()
           
static void testGetInts()
           
static void testGetReadFile()
           
static void testGetTokenizer()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReaderUtil

public ReaderUtil()
Method Detail

setReader

public static void setReader(java.io.BufferedReader _br)

getReader

public static java.io.BufferedReader getReader()

getString

public static java.lang.String getString(java.lang.String prompt)

getBytes

public static byte[] getBytes(int i)
                       throws java.io.IOException
Throws:
java.io.IOException

getInt

public static int[] getInt(byte[] b)

testGetInts

public static void testGetInts()

getInts

public static int[] getInts(float f)

getBytes

public static byte[] getBytes(java.lang.String[] o)
                       throws java.io.IOException
Throws:
java.io.IOException

print

public static void print(java.lang.Object[] o)

print

public static void print(int[] o)

sum

public static int sum(int[] o)

string2Int

public static int[] string2Int(java.lang.String[] s)

getTokens

public static java.lang.String[] getTokens(java.lang.String s)

testGetFile

public static void testGetFile()

getFileAsStringArray

public static java.lang.String[] getFileAsStringArray(java.io.File f)
                                               throws java.io.FileNotFoundException
Reads in a text file

Parameters:
f - file to be read in
Returns:
an array of string, one line per array element
Throws:
java.io.FileNotFoundException

getAddressBook

public static SimpleAddressBook getAddressBook()
Obtain a list of records using a given record delimiter. For example, input a file and a delimiter (^m) and return an array of records.
String s[] = getRecords(f, '\r');
In java, C and C++, '\r' = carrage return, '\f' = form feed (or line feed) ^m is a carrage...

Returns:
unparsed array of records as String

getAddressBook

public static SimpleAddressBook getAddressBook(java.io.File f,
                                               java.lang.String c)
                                        throws java.io.IOException
Do a getRecords with

Parameters:
f - as the input file
c - as the delimiting character
Returns:
records in the order in which they appear in the file
Throws:
java.io.IOException

listFile

public static void listFile()

readQuestion

public static void readQuestion(java.lang.String s)

testGetTokenizer

public static void testGetTokenizer()

isReadableFile

public static boolean isReadableFile(java.io.File f)
isReadableFile() - validates the file is exists and readable

Parameters:
f - The file to be examined.
Returns:
boolean - file is readable true/false

getBufferedReader

public static java.io.BufferedReader getBufferedReader(java.lang.String prompt)
"@param prompt


getBufferedReader

public static java.io.BufferedReader getBufferedReader(java.io.File f)
"@param f


readLine

public static java.lang.String readLine(java.io.BufferedReader br)
Parameters:
br -

close

public static void close(java.io.BufferedReader br)
"@param br


testGetReadFile

public static void testGetReadFile()

getFileReader

public static java.io.FileReader getFileReader(java.lang.String prompt)

getFileReader

public static java.io.FileReader getFileReader(java.io.File file)

close

public static void close(java.io.FileReader fr)

readDataFile

public static void readDataFile(java.io.File file,
                                double[] data)
                         throws java.io.IOException
Parameters:
file -
data -
Throws:
java.io.IOException

countTokens

public static int countTokens(java.io.BufferedReader br)
Prompts the user for a file and counts the tokens.

Returns:
returns the number of tokens in a file

listFilteredHrefFile

public static void listFilteredHrefFile(java.io.File file)

parseBoolean

public static boolean parseBoolean(java.lang.String s)
                            throws BooleanException
Throws:
BooleanException

getBoolean

public static boolean getBoolean(java.lang.String prompt)

getInt

public static int getInt(java.lang.String prompt)

getDouble

public static double getDouble(java.lang.String prompt)

getFileAsOneBigString

public static java.lang.String getFileAsOneBigString(java.io.File f)
Returns the file instance as a string, reading it in, one line affineTransform a time.

Parameters:
f - is used as input
Returns:
file contents of the file in one big string;

main

public static void main(java.lang.String[] args)