Ejemplo n.º 1
0
 public VotCopyTest(String name) throws Exception {
   super(name);
   Logger.getLogger("uk.ac.starlink.table").setLevel(Level.WARNING);
   multiDOM_ = checkAndRemoveData(new VOElementFactory().makeVOElement(multiLoc_), "TABLEDATA");
   VOTableBuilder vbuilder = new VOTableBuilder();
   DataSource dsrc = new URLDataSource(multiLoc_);
   StoragePolicy policy = StoragePolicy.PREFER_MEMORY;
   dsrc.setPosition("0");
   t1_ = vbuilder.makeStarTable(dsrc, true, policy);
   dsrc.setPosition("1");
   t2_ = vbuilder.makeStarTable(dsrc, true, policy);
 }
Ejemplo n.º 2
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;
  }