Package net.ivoa.fits

Examples of net.ivoa.fits.FitsException


  }

  /** Modify a row in the table */
  public void setRow(int row, Object[] newData) throws FitsException {
    if (row < 0 || row > nRows) {
      throw new FitsException("Invalid row in setRow");
    }

    if (data == null) {
      getData();
    }
    for (int i = 0; i < nFields; i += 1) {
      try {
        System.arraycopy(newData[i], 0, data[i], row, 1);
      } catch (Exception e) {
        throw new FitsException(
            "Unable to modify row: incompatible data:" + row);
      }
    }

    // Invalidate the buffer
View Full Code Here


      getData();
    }
    try {
      System.arraycopy(newData, 0, data[col], row, 1);
    } catch (Exception e) {
      throw new FitsException("Incompatible element:" + row + "," + col);
    }

    // Invalidate the buffer
    buffer = null;
  }
View Full Code Here

   * associated with each column type.
   */
  public int addColumn(Object newCol, int length) throws FitsException {

    if (nFields > 0 && Array.getLength(newCol) != nRows) {
      throw new FitsException("New column has different number of rows");
    }

    if (nFields == 0) {
      nRows = Array.getLength(newCol);
    }
View Full Code Here

                newLen = len;
            }
            resizeCol (i, newLen);
          }
        } catch (Exception e) {
          throw new FitsException("Error adding row:" + e);
        }
      }
      nRows += 1;
    }
View Full Code Here

  public abstract void read(ArrayDataInput i) throws FitsException;

  public void rewrite() throws FitsException {

    if (!rewriteable()) {
      throw new FitsException("Illegal attempt to rewrite data");
    }

    FitsUtil.reposition(input, fileOffset);
    write((ArrayDataOutput) input);
    try {
      ((ArrayDataOutput) input).flush();
    } catch (IOException e) {
      throw new FitsException("Error in rewrite flush: " + e);
    }
  }
View Full Code Here

    if (heap != null) {
      try {
        str.read(heap, 0, heapSize);
      } catch (IOException e) {
        throw new FitsException("Error reading heap:" + e);
      }
    }
  }
View Full Code Here

  /** Write the heap */
  public void write(ArrayDataOutput str) throws FitsException {
    try {
      str.write(heap, 0, heapSize);
    } catch (IOException e) {
      throw new FitsException("Error writing heap:" + e);
    }
  }
View Full Code Here

    if (rewriteable()) {
      ArrayDataOutput str = (ArrayDataOutput) input;
      FitsUtil.reposition(str, fileOffset);
      write(str);
    } else {
      throw new FitsException("Invalid attempt to rewrite FitsHeap");
    }

  }
View Full Code Here

      bstr.skipBytes(offset - heapOffset);
      heapOffset = offset;
      heapOffset += bstr.readArray(array);

    } catch (IOException e) {
      throw new FitsException("Error decoding heap area at offset="
          + offset + ".  Exception: Exception " + e);
    }
  }
View Full Code Here

      BufferedDataOutputStream o = new BufferedDataOutputStream(bo);
      o.writeArray(data);
      o.flush();
      o.close();
    } catch (IOException e) {
      throw new FitsException(
          "Unable to write variable column length data");
    }

    System.arraycopy(bo.toByteArray(), 0, heap, heapSize, size);
    int oldOffset = heapSize;
View Full Code Here

TOP

Related Classes of net.ivoa.fits.FitsException

Copyright © 2018 www.massapicom. 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.