cynosurex.io
Class ioRoutines

java.lang.Object
  extended by cynosurex.io.ioRoutines
All Implemented Interfaces:
cynosurex.internal.AuthorCommon, cynosurex.internal.CommonInterface, cynosurex.internal.CompanyCommon

public final class ioRoutines
extends java.lang.Object
implements cynosurex.internal.CommonInterface

The ioRoutines class contains several useful class fields and methods. It cannot be instantiated.

Version:
1.0, 6/2/1997
Author:
Chieh Cheng

Field Summary
 
Fields inherited from interface cynosurex.internal.CommonInterface
copyright, copyrightYears, notice, program, version
 
Fields inherited from interface cynosurex.internal.AuthorCommon
author, copyrightSymbol, noticeMsg, rights
 
Fields inherited from interface cynosurex.internal.CompanyCommon
company, email, website
 
Method Summary
static java.lang.String readFile(java.io.File file)
          Takes a file name and returns the content of the file in a String object.
static java.lang.String readfile(java.lang.String filename)
          Takes a file name and returns the content of the file in a String object.
static java.lang.String readLine()
          This method reads a line from standard input.
static java.lang.String readLine(int bufferSize)
          This method reads a line from standard input.
static java.lang.String readUTF(java.lang.String filename)
          Takes a file name, decodes the UTF-8 encoding, and returns the content of the file in a String object.
static void writeFile(java.io.File file, java.lang.String str)
          Saves a String object into a file.
static void writefile(java.lang.String filename, java.lang.String str)
          Saves a String object into a file.
static void writeUTF(java.lang.String filename, java.lang.String str)
          Saves a String object into a file using UTF-8 encoding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readFile

public static java.lang.String readFile(java.io.File file)
                                 throws java.io.IOException
Takes a file name and returns the content of the file in a String object. This method has been updated to Java 1.1 and will automatically provide ASCII to Unicode conversion, when necessary.

Parameters:
file - The file object.
Throws:
java.io.IOException

readfile

public static java.lang.String readfile(java.lang.String filename)
                                 throws java.io.IOException
Takes a file name and returns the content of the file in a String object. This method has been updated to Java 1.1 and will automatically provide ASCII to Unicode conversion, when necessary.

Throws:
java.io.IOException

readLine

public static java.lang.String readLine()
This method reads a line from standard input. It's perfect for user interaction on the command-line. Surprisingly, System.in does not support an easy interface for reading an user-input line of text. This method makes the process easy. By default, this method has the ability to read in a text line up to 1024 bytes. If you need a bigger buffer, use its overloaded method. Note: white spaces at the beginning and end of the line is trimmed away.


readLine

public static java.lang.String readLine(int bufferSize)
This method reads a line from standard input. It's perfect for user interaction on the command-line. Surprisingly, System.in does not support an easy interface for reading an user-input line of text. This method makes the process easy. This method has the ability to read in a text line up to specified buffer size (in bytes). Note: white spaces at the beginning and end of the line is trimmed away.


writeFile

public static void writeFile(java.io.File file,
                             java.lang.String str)
                      throws java.io.IOException
Saves a String object into a file. This method has been updated to Java 1.1 and will automatically provide Unicode to ASCII conversion, when necessary.

Parameters:
file - the File object.
str - the String object to be saved into the file.
Throws:
java.io.IOException

writefile

public static void writefile(java.lang.String filename,
                             java.lang.String str)
                      throws java.io.IOException
Saves a String object into a file. This method has been updated to Java 1.1 and will automatically provide Unicode to ASCII conversion, when necessary.

Parameters:
filename - the name of the file.
str - the String object to be saved into the file.
Throws:
java.io.IOException

readUTF

public static java.lang.String readUTF(java.lang.String filename)
                                throws java.io.IOException
Takes a file name, decodes the UTF-8 encoding, and returns the content of the file in a String object.

Throws:
java.io.IOException

writeUTF

public static void writeUTF(java.lang.String filename,
                            java.lang.String str)
                     throws java.io.IOException
Saves a String object into a file using UTF-8 encoding.

Parameters:
filename - - the name of the file.
str - - the String object to be saved into the file.
Throws:
java.io.IOException