示例#1
0
  /**
   * Constructor. Note that a FileIO object only does input or output on a file, not both.
   *
   * @param newFileName The name of the file you want to operate on.
   * @param mode The mode of operations, 0 = input, 1 = output
   */
  public FileIO(String newFileName, int mode) {
    filename = newFileName;
    f = new File(filename);

    if (mode == 0) // input
    {
      size = (int) f.length();
      data = new char[size];
      readEverything();
    } else // output
    {
      size = 0;
    }
  }