public Map < String , Table > process ( File directory , String prefix ) throws IOException { String filePrefix = prefix . toUpperCase ( ) ; Map < String , Table > tables = new HashMap < String , Table > ( ) ; File [ ] files = directory . listFiles ( ) ; if ( files != null ) { for ( File file : files ) { String name = file . getName ( ) . toUpperCase ( ) ; if ( ! name . startsWith ( filePrefix ) ) { continue ; } int typeIndex = name . lastIndexOf ( ' ' ) - 3 ; String type = name . substring ( typeIndex , typeIndex + 3 ) ; TableDefinition definition = TABLE_DEFINITIONS . get ( type ) ; if ( definition != null ) { Table table = new Table ( ) ; TableReader reader = new TableReader ( definition ) ; reader . read ( file , table ) ; tables . put ( type , table ) ; //dumpCSV(type, definition, table); } } } return tables ; }
Main entry point . Reads a directory containing a P3 Btrieve database files and returns a map of table names and table content .