    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class jclass.util.JCFile

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

public class JCFile
extends Object

A collection of file-reading methods.

##

JCFile()

##

createURL(Applet, String)
  Returns an URL from the file
read(Applet, String)
  Reads data from a file and returns it as a String.
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.
readCSV(Component, String)
  Reads the data from a file and parses it as a comma-separated value file.
readLines(Applet, String)
  Reads data from a file and returns it as a Vector of Strings.
readLines(Applet, String, int, int)
  Reads data from a file and returns it as a Vector of Strings.

##

JCFile

     public JCFile()

##

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

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()

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 an applet is available, it should be passed as 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 list of cells that can be used in call to JCTable.setCells()

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.

readLines

     public static Vector readLines(Applet applet,
                                    String file,
                                    int from_line,
                                    int to_line)

  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.
    from_line - line number at which to start reading
    to_line - last line number to read
  Returns:
    array of strings where each string represents a line in the file. Returns null if an error occurred.

read

     public static String read(Applet applet,
                               String file)

  Reads data from a file and returns it as a String. Each line in the file is appended, without the terminating newline character.

  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 null if the file could not be read

    All Packages  Class Hierarchy  This Package  Previous  Next  Index