Examples of FitsException


Examples of net.ivoa.fits.FitsException

    } else if (bases[col] == boolean.class) {
      tform += "L";
    } else if (bases[col] == String.class) {
      tform += "A";
    } else {
      throw new FitsException("Invalid column data class:" + bases[col]);
    }

    String key = "TFORM" + (col + 1);
    iter.add(key, new HeaderCard(key, tform, null));
View Full Code Here

Examples of net.ivoa.fits.FitsException

    ColumnTable table;

    try {
      table = new ColumnTable(arrCol, sizes);
    } catch (TableException e) {
      throw new FitsException("Unable to create table:" + e);
    }

    return table;
  }
View Full Code Here

Examples of net.ivoa.fits.FitsException

   * @return A row of data.
   */
  public Object[] getRow(int row) throws FitsException {

    if (!validRow(row)) {
      throw new FitsException("Invalid row");
    }

    Object[] res;
    if (table != null) {
      res = getMemoryRow(row);
View Full Code Here

Examples of net.ivoa.fits.FitsException

    try {
      FitsUtil.reposition(currInput, fileOffset + row * rowLen);
      currInput.readArray(data);
    } catch (IOException e) {
      throw new FitsException("Error in deferred row read");
    }
    for (int col = 0; col < data.length; col += 1) {
      data[col] = columnToArray(col, data[col]);
      data[col] = encurl(data[col], col, 1);
      if (data[col] instanceof Object[]) {
View Full Code Here

Examples of net.ivoa.fits.FitsException

    if (table == null) {
      getData();
    }

    if (data.length != getNCols()) {
      throw new FitsException(
          "Updated row size does not agree with table");
    }

    Object[] ydata = new Object[data.length];

    for (int col = 0; col < data.length; col += 1) {
      Object o = ArrayFuncs.flatten(data[col]);
      ydata[col] = arrayToColumn(col, o);
    }

    try {
      table.setRow(row, ydata);
    } catch (TableException e) {
      throw new FitsException("Error modifying table: " + e);
    }
  }
View Full Code Here

Examples of net.ivoa.fits.FitsException

    data = arrayToColumn(col, data);

    Object oldCol = table.getColumn(col);
    if (data.getClass() != oldCol.getClass()
        || Array.getLength(data) != Array.getLength(oldCol)) {
      throw new FitsException("Replacement column mismatch at column:"
          + col);
    }
    try {
      table.setColumn(col, data);
    } catch (TableException e) {
      throw new FitsException("Unable to set column:" + col + " error:"
          + e);
    }
  }
View Full Code Here

Examples of net.ivoa.fits.FitsException

    if (table == null) {
      getData();
    }

    if (!validColumn(col)) {
      throw new FitsException("Invalid column");
    }

    return columnToArray(col, table.getColumn(col));
  }
View Full Code Here

Examples of net.ivoa.fits.FitsException

   *            The column of the element.
   */
  public Object getElement(int i, int j) throws FitsException {

    if (!validRow(i) || !validColumn(j)) {
      throw new FitsException("No such element");
    }

    Object ele;
    if (table == null) {
      // This is really inefficient.
View Full Code Here

Examples of net.ivoa.fits.FitsException

        flatRow[i] = arrayToColumn(i, x);
      }
      try {
        table.addRow(flatRow);
      } catch (TableException e) {
        throw new FitsException("Error add row to table");
      }

      nRow += 1;
    }
View Full Code Here

Examples of net.ivoa.fits.FitsException

    int xRow = Array.getLength(o) / size;
    if (getNCols() == 0) {
      nRow = xRow;
    } else if (xRow > 0) {
      if (xRow != nRow) {
        throw new FitsException(
            "Added column does not have correct row count");
      }
    }

    if ((flags[nCol] & COL_VARYING) == 0) {
      modelRow[nCol] = ArrayFuncs.newInstance(ArrayFuncs.getBaseClass(o),
          dims);
      rowLen += size * ArrayFuncs.getBaseLength(o);
    } else {
      modelRow[nCol] = new int[2];
      rowLen += 8;
    }

    // Only add to table if table already exists or if we
    // are filling up the last element in columns.
    // This way if we allocate a bunch of columns at the beginning
    // we only create the column table after we have all the columns
    // ready.

    columns[nCol] = o;

    try {
      if (table != null) {
        table.addColumn(o, sizes[nCol]);
      } else if (nCol == columns.length - 1) {
        table = new ColumnTable(columns, sizes);
      }
    } catch (TableException e) {
      throw new FitsException("Error in ColumnTable:" + e);
    }

    nCol += 1;
    return nCol;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.