4 * This exception is thrown if an error is found
5 * reading the padding following a valid FITS HDU.
6 * This padding is required by the FITS standard, but
7 * some FITS writes forego writing it. To access such data
8 * users can use something like:
11 * Fits f = new Fits("somefile");
14 * } catch (PaddingException e) {
15 * f.addHDU(e.getHDU());
18 * to ensure that a truncated HDU is included in the FITS object.
19 * Generally the FITS file have already added any HDUs prior
20 * to the truncatd one.
22 public class PaddingException extends FitsException {
24 /** The HDU where the error happened.
26 private BasicHDU truncatedHDU;
29 * When the error is thrown, the data object being
30 * read must be supplied. We initially create a dummy
31 * header for this. If someone is reading the entire
32 * HDU, then they can trap the exception and set the header
33 * to the appropriate value.
35 public PaddingException(Data datum) throws FitsException {
36 truncatedHDU = FitsFactory.HDUFactory(datum.getKernel());
37 // We want to use the original Data object... so
38 truncatedHDU = FitsFactory.HDUFactory(truncatedHDU.getHeader(), datum);
41 public PaddingException(String msg, Data datum) throws FitsException {
43 truncatedHDU = FitsFactory.HDUFactory(datum.getKernel());
44 truncatedHDU = FitsFactory.HDUFactory(truncatedHDU.getHeader(), datum);
47 void updateHeader(Header hdr) throws FitsException {
48 truncatedHDU = FitsFactory.HDUFactory(hdr, truncatedHDU.getData());
51 public BasicHDU getTruncatedHDU() {