String line = in.readLine(); if (line == null || line.trim().length() == 0) { return; }  String tableName = escape(name); int counter = 0; while(getTable(tableName) != null) { tableName = escape(name + (counter++)); }  List<Column> columns = new LinkedList<Column>(); String[] columnNames = line.split(delim);  short textSize = (short) ((JetFormat.MAX_RECORD_SIZE) / columnNames.length); if (textSize > JetFormat.TEXT_FIELD_MAX_LENGTH) { textSize = JetFormat.TEXT_FIELD_MAX_LENGTH; }  for (int i = 0; i < columnNames.length; i++) { Column column = new Column(); column.setName(escape(columnNames[i])); column.setType(DataType.TEXT); column.setLength(textSize); columns.add(column); }  createTable(tableName, columns); Table table = getTable(tableName); List<String[]> rows = new ArrayList<String[]>();  while ((line = in.readLine()) != null) {      String[] data = new String[columnNames.length]; String[] splitData = line.split(delim); System.arraycopy(splitData, 0, data, 0, splitData.length); rows.add(data); if (rows.size() == COPY_TABLE_BATCH_SIZE) { table.addRows(rows); rows.clear(); } } if (rows.size() > 0) { table.addRows(rows); }
importReader(name, in, delim, SimpleImportFilter.INSTANCE);
  public void importReader(String name, BufferedReader in, String delim)  throws IOException  {    String line = in.readLine();    if (line == null || line.trim().length() == 0) {      return;    }    String tableName = escape(name);    int counter = 0;    while(getTable(tableName) != null) {      tableName = escape(name + (counter++));    }    List<Column> columns = new LinkedList<Column>();    String[] columnNames = line.split(delim);          short textSize = (short) ((JetFormat.MAX_RECORD_SIZE) / columnNames.length);    if (textSize > JetFormat.TEXT_FIELD_MAX_LENGTH) {      textSize = JetFormat.TEXT_FIELD_MAX_LENGTH;    }    for (int i = 0; i < columnNames.length; i++) {      Column column = new Column();      column.setName(escape(columnNames[i]));      column.setType(DataType.TEXT);      column.setLength(textSize);      columns.add(column);    }          createTable(tableName, columns);    Table table = getTable(tableName);    List<String[]> rows = new ArrayList<String[]>();          while ((line = in.readLine()) != null)    {      //       // Handle the situation where the end of the line      // may have null fields.  We always want to add the      // same number of columns to the table each time.      //      String[] data = new String[columnNames.length];      String[] splitData = line.split(delim);      System.arraycopy(splitData, 0, data, 0, splitData.length);      rows.add(data);      if (rows.size() == COPY_TABLE_BATCH_SIZE) {        table.addRows(rows);        rows.clear();      }    }    if (rows.size() > 0) {      table.addRows(rows);    }  }