示例#1
0
  public StarTable makeStarTable(DataSource datsrc, boolean wantRandom, StoragePolicy storagePolicy)
      throws IOException {

    /* If it doesn't start how we expect WDC text to start, bail
     * out straight away. */
    String start = new String(datsrc.getIntro());
    if (!start.startsWith("Column formats and units")) {
      throw new TableFormatException("Doesn't start \"" + "Column formats and units\"");
    }

    /* Looks OK, make a serious attempt to read it. */
    BufferedInputStream strm = new BufferedInputStream(datsrc.getInputStream());

    /* Try to parse the meaningful parts of the header info. */
    WDCReader wdcReader = new WDCReader(strm);

    /* Return a new table based on this understanding. */
    WDCStarTable st = new WDCStarTable(wdcReader, datsrc);
    st.setURL(datsrc.getURL());
    st.setName(datsrc.getName());
    return st;
  }