public BinaryTable(Header myHeader) throws FitsException {
  long heapSizeL=myHeader.getLongValue(PCOUNT);
  long heapOffsetL=myHeader.getLongValue(THEAP);
  if (heapOffsetL > MAX_INTEGER_VALUE) {
    throw new FitsException("Heap Offset > 2GB");
  }
  if (heapSizeL > MAX_INTEGER_VALUE) {
    throw new FitsException("Heap size > 2 GB");
  }
  if (heapSizeL - heapOffsetL > MAX_INTEGER_VALUE) {
    throw new FitsException("Unable to allocate heap > 2GB");
  }
  this.heapOffset=(int)heapOffsetL;
  int heapSize=(int)heapSizeL;
  int rwsz=myHeader.getIntValue(NAXIS1);
  this.nRow=myHeader.getIntValue(NAXIS2);
  if (this.heapOffset > 0) {
    this.heapOffset-=this.nRow * rwsz;
  }
  if (this.heapOffset < 0 || this.heapOffset > heapSize) {
    throw new FitsException("Inconsistent THEAP and PCOUNT");
  }
  this.heap=new FitsHeap(heapSize - this.heapOffset);
  int nCol=myHeader.getIntValue(TFIELDS);
  this.rowLen=0;
  for (int col=0; col < nCol; col++) {
    this.rowLen+=processCol(myHeader,col);
  }
  HeaderCard card=myHeader.findCard(NAXIS1);
  card.setValue(String.valueOf(this.rowLen));
  myHeader.updateLine(NAXIS1,card);
}

public BinaryTable ( Header myHeader ) throws FitsException { long heapSizeL = myHeader . getLongValue ( PCOUNT ) ; long heapOffsetL = myHeader . getLongValue ( THEAP ) ; if ( heapOffsetL > MAX_INTEGER_VALUE ) { throw new FitsException ( "Heap Offset > 2GB" ) ; } if ( heapSizeL > MAX_INTEGER_VALUE ) { throw new FitsException ( "Heap size > 2 GB" ) ; } if ( heapSizeL - heapOffsetL > MAX_INTEGER_VALUE ) { throw new FitsException ( "Unable to allocate heap > 2GB" ) ; } this . heapOffset = ( int ) heapOffsetL ; int heapSize = ( int ) heapSizeL ; int rwsz = myHeader . getIntValue ( NAXIS1 ) ; this . nRow = myHeader . getIntValue ( NAXIS2 ) ; if ( this . heapOffset > 0 ) { this . heapOffset -= this . nRow * rwsz ; } if ( this . heapOffset < 0 || this . heapOffset > heapSize ) { throw new FitsException ( "Inconsistent THEAP and PCOUNT" ) ; } this . heap = new FitsHeap ( heapSize - this . heapOffset ) ; int nCol = myHeader . getIntValue ( TFIELDS ) ; this . rowLen = 0 ; for ( int col = 0 ; col < nCol ; col ++ ) { this . rowLen += processCol ( myHeader , col ) ; } HeaderCard card = myHeader . findCard ( NAXIS1 ) ; card . setValue ( String . valueOf ( this . rowLen ) ) ; myHeader . updateLine ( NAXIS1 , card ) ; }
create a binary table from given header information .
