All Packages  Class Hierarchy  This Package    Next  Index


Class jclass.util.JCFile

java.lang.Object
   |
   +----jclass.util.JCFile


public class JCFile
extends Object

This is a collection of methods to be used when reading data from a file.


Constructor Index

 o JCFile()

Method Index

 o createURL(Applet, String)
Returns an URL from the file
 o read(Applet, String)
Reads data from a file and returns it as a String
 o read(Component, String, char, boolean)
Reads the data from a file, parses it based on the provided delimiter, then converts it into cell values and returns it in a JCVector of JCVectors.
 o readCSV(Component, String)
Reads the data from a file and parses it as a comma-separated value file.
 o readLines(Applet, String)
Reads data from a file and returns it as a Vector of Strings.

Constructors

 o JCFile

  public JCFile()

Methods

 o createURL

  public static URL createURL(Applet applet,
                              String file)
Returns an URL from the file
Parameters:
applet - if not null and in a browser, its documentBase() is used to construct a complete filename if necessary
file - if an http protocol is not specified (a ":" is not present), the current working directory is prepended to the file name
Returns:
an instance of java.net.URL that represents a net connection

 o read

  public static JCVector read(Component comp,
                              String file,
                              char delim,
                              boolean convert)
Reads the data from a file, parses it based on the provided delimiter, then converts it into cell values and returns it in a JCVector of JCVectors.
Parameters:
comp - if an applet in a browser, its documentBase() is used to construct a complete filename if necessary. If you have an applet, pass it in comp.
file - the file which is read. If an http protocol is not specified (a ":" is not present), the current working directory is prepended to the file name.
delim - the delimiter used in parsing
convert - if true, a token is converted to a JCString if it contains a square bracket ([).
Returns:
array of array of cells that can be sent to JCTable.setCells()

 o readCSV

  public static JCVector readCSV(Component comp,
                                 String file)
Reads the data from a file and parses it as a comma-separated value file. It then converts it into cell values and returns it in a JCVector of JCVectors.
Parameters:
comp - if an applet in a browser, its documentBase() is used to construct a complete filename if necessary. If you have an applet, pass it in comp.
file - the file from which to read. If an http protocol is not specified (a ":" is not present), the current working directory is prepended to the file name
Returns:
array of array of cells that can be sent to JCTable.setCells()

 o readLines

  public static Vector readLines(Applet applet,
                                 String file)
Reads data from a file and returns it as a Vector of Strings. Each string represents a single line returned from the file.
Parameters:
applet - if not null and in a browser, its documentBase() is used to construct a complete filename if necessary
file - the file to be read. If an http protocol is not specified (a ":" is not present), the current working directory is prepended to the file name.
Returns:
array of strings where each string represents a line in the file. Returns null if an error occurred.

 o read

  public static String read(Applet applet,
                            String file)
Reads data from a file and returns it as a String
Parameters:
applet - if not null, its documentBase() is used to construct a complete filename if necessary.
file - the file to be read. If an http protocol is not specified (a ":" is not present), the current working directory is prepended to the file name
Returns:
string containing the contents of the file.


All Packages  Class Hierarchy  This Package    Next  Index