database/src/DbTable.java
public static DbTable constructFromFile(String inputFileName)
            throws IllegalArgumentException, java.io.FileNotFoundException {
        String line = null;
        //make sure program can access file
        //if not throw error
        try{
            FileReader reader = new FileReader(inputFileName);
            BufferedReader buffRead = new BufferedReader(reader);
            line = buffRead.readLine();
            ArrayList<String> entry = new ArrayList<String>();
            String delims = "[ ]+";
            String[] column = line.split(delims);

            for(int i =0; i< column.length; i++){
                String col = column[i];
                entry.add(col);
            }

            if (isAlphaNumColNam(entry) == false){
                throw new IllegalArgumentException("Column names are not alphanumeric");
            }

            DbTable table = new DbTable(entry);


            while((line = buffRead.readLine()) != null) {
            //TODO: DO something

            }
            buffRead.close();

        }

        catch(FileNotFoundException ex1){
            System.out.println( "Could not open file."
                    + inputFileName +" not found");
        }

        catch (IOException ex2){
            System.out.println("Error reading file "
                    + inputFileName);
        }

        return null;
    }
/**
     * Reads a saved table file (usually one written by the writeToFile method) and re-constructs the DbTable instance.
     * See writeToFile for description of file format.
     *
     * @param inputFileName     Name of the file to read
     * @return                  DbTable instance
     * @throws                  java.io.FileNotFoundException if the specified file doesn't exist.
     * @throws                  java.util.IllegalFormatException if the specified file exists but is malformed.
     */
Reads a saved table file (usually one written by the writeToFile method) and re-constructs the DbTable instance.
See writeToFile for description of file format.

@param inputFileName     Name of the file to read
@return                  DbTable instance
@throws                  java.io.FileNotFoundException if the specified file doesn't exist.
@throws                  java.util.IllegalFormatException if the specified file exists but is malformed.
Reads a saved table file ( usually one written by the writeToFile method ) and re - constructs the DbTable instance . See writeToFile for description of file format . @param inputFileName Name of the file to read @return DbTable instance @throws java . io . FileNotFoundException if the specified file doesn ' t exist . @throws java . util . IllegalFormatException if the specified file exists but is malformed .
public static DbTable constructFromFile(String inputFileName)
            throws IllegalArgumentException, java.io.FileNotFoundException {
        String line = null;
        try{
            FileReader reader = new FileReader(inputFileName);
            BufferedReader buffRead = new BufferedReader(reader);
            line = buffRead.readLine();
            ArrayList<String> entry = new ArrayList<String>();
            String delims = "[ ]+";
            String[] column = line.split(delims);
            for(int i =0; i< column.length; i++){
                String col = column[i];
                entry.add(col);
            }
            if (isAlphaNumColNam(entry) == false){
                throw new IllegalArgumentException("Column names are not alphanumeric");
            }
            DbTable table = new DbTable(entry);
            while((line = buffRead.readLine()) != null) {
            }
            buffRead.close();
        }
        catch(FileNotFoundException ex1){
            System.out.println( "Could not open file."
                    + inputFileName +" not found");
        }
        catch (IOException ex2){
            System.out.println("Error reading file "
                    + inputFileName);
        }
        return null;
    }
public static DbTable constructFromFile ( String inputFileName ) throws IllegalArgumentException , java . io . FileNotFoundException { String line = null ; try { FileReader reader = new FileReader ( inputFileName ) ; BufferedReader buffRead = new BufferedReader ( reader ) ; line = buffRead . readLine ( ) ; ArrayList < String > entry = new ArrayList < String > ( ) ; String delims = "[ ]+" ; String [ ] column = line . split ( delims ) ; for ( int i = 0 ; i < column . length ; i ++ ) { String col = column [ i ] ; entry . add ( col ) ; } if ( isAlphaNumColNam ( entry ) == false ) { throw new IllegalArgumentException ( "Column names are not alphanumeric" ) ; } DbTable table = new DbTable ( entry ) ; while ( ( line = buffRead . readLine ( ) ) != null ) { } buffRead . close ( ) ; } catch ( FileNotFoundException ex1 ) { System . out . println ( "Could not open file." + inputFileName + " not found" ) ; } catch ( IOException ex2 ) { System . out . println ( "Error reading file " + inputFileName ) ; } return null ; }
Reads a saved table file (usually one written by the writeToFile method) and re-constructs the DbTable instance.
Reads a saved table file ( usually one written by the writeToFile method ) and re - constructs the DbTable instance .
//make sure program can access file //if not throw error //TODO: DO something