Using the API

Fits fits = new Fits("FITS_HOME"); 
FitsOutput fitsOut = fits.examine(input);
fitsOutput
.saveToDisk("output/path/to/file");

FITS_HOME is the directory containing the XML and tools directories. It can either be passed into the Fits() constructor, or it can be set as a system environment variable. All required FITS jars need to be on the classpath. The xml/nlnz directory also has to be added to the classpath.

The FITS XML can be retrieved from FitsOutput as a JDOM object: FitsOutput.getFitsXml()

Several convenience methods are provided. (This is not a complete list).

  • Test for an element with name: boolean hasElement = fitsOutput.hasMetadataElement("name");
  • Look up a single element by name: FitsMetadataElement element = fitsOutput.getMetadataElement("name");
  • Look up a list of all elements by name: List<FitsMetadataElement> elements = fitsOutput.getMetadataElements("name");
  • Get a list of all elements in the FileInfo section: List<FitsMetadataElement> elements = fitsOutput.getFileInfoElements();
  • Get a list of all elements in the FileStatus section: List<FitsMetadataElement> elements = fitsOutput.getFileStatusElements();
  • Get the technical metadata type of the output (image, text, audio, document): String type = fitsOutput.getTechMetadataType();
  • Get a list of all elements in the technical metadata section: List<FitsMetadataElement> elements = fitsOutput.getTechMetadataElements();
  • Test for conflicting metadata values by name: Boolean hasConflict = hasConflictingMetadataElements("name");