Package gov.nasa.pds.transform.util
Class Utility
- java.lang.Object
-
- gov.nasa.pds.transform.util.Utility
-
public class Utility extends Object
Utility class.
-
-
Constructor Summary
Constructors Constructor Description Utility()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FilecreateOutputFile(File file, File outputDir, String format)static FilecreateOutputFile(File file, File outputDir, String format, int index)static voidexec(File program, String[] args)static voidgenerate(File target, File outputFile, String templateName)static voidgenerate(File target, File outputFile, String templateName, List<String> includePaths)static StringgetDateTime()Get the current date time.static gov.nasa.arc.pds.xml.generated.FileAreaObservationalgetFileArea(File pds4Label, String dataFile)static List<gov.nasa.arc.pds.xml.generated.FileAreaObservational>getFileAreas(File pds4Label)static List<gov.nasa.arc.pds.xml.generated.FileAreaObservational>getFileAreas(URL pds4Label)static FilegetFileFromURL(URL url, File outputDir)static intgetHDUIndex(File fitsFile, int index)Gets the HDU index that corresponds to the given index.static ImagePropertiesgetImageProperties(File pds4Label)Gets image properties associated with the given PDS4 label.static ImagePropertiesgetImageProperties(URL pds4Label)static URLgetParent(URL url)static List<gov.nasa.arc.pds.xml.generated.Array>getSupportedImages(List<gov.nasa.arc.pds.xml.generated.Array> arrays)Returns a list of supported image objects.static gov.nasa.pds.tools.label.LabelparsePds3Label(File label)static gov.nasa.pds.tools.label.LabelparsePds3Label(URL label)static URLtoURL(String s)Convert a string to a URL.static StringtoWellFormedURI(String s)Convert a string to a URI.
-
-
-
Method Detail
-
toURL
public static URL toURL(String s) throws MalformedURLException
Convert a string to a URL.- Parameters:
s- The string to convert- Returns:
- A URL of the input string
- Throws:
MalformedURLException
-
toWellFormedURI
public static String toWellFormedURI(String s)
Convert a string to a URI.- Parameters:
s- The string to convert.- Returns:
- A well-formed URI.
-
getDateTime
public static String getDateTime()
Get the current date time.- Returns:
- A date time.
-
parsePds3Label
public static gov.nasa.pds.tools.label.Label parsePds3Label(File label) throws Exception
- Throws:
Exception
-
parsePds3Label
public static gov.nasa.pds.tools.label.Label parsePds3Label(URL label) throws Exception
- Throws:
Exception
-
getFileAreas
public static List<gov.nasa.arc.pds.xml.generated.FileAreaObservational> getFileAreas(File pds4Label) throws gov.nasa.pds.objectAccess.ParseException, MalformedURLException, URISyntaxException
- Throws:
gov.nasa.pds.objectAccess.ParseExceptionMalformedURLExceptionURISyntaxException
-
getFileAreas
public static List<gov.nasa.arc.pds.xml.generated.FileAreaObservational> getFileAreas(URL pds4Label) throws gov.nasa.pds.objectAccess.ParseException, MalformedURLException, URISyntaxException, IOException
- Throws:
gov.nasa.pds.objectAccess.ParseExceptionMalformedURLExceptionURISyntaxExceptionIOException
-
getFileArea
public static gov.nasa.arc.pds.xml.generated.FileAreaObservational getFileArea(File pds4Label, String dataFile) throws gov.nasa.pds.objectAccess.ParseException, MalformedURLException, URISyntaxException
- Throws:
gov.nasa.pds.objectAccess.ParseExceptionMalformedURLExceptionURISyntaxException
-
createOutputFile
public static File createOutputFile(File file, File outputDir, String format, int index)
-
exec
public static void exec(File program, String[] args) throws IOException, InterruptedException
- Throws:
IOExceptionInterruptedException
-
generate
public static void generate(File target, File outputFile, String templateName) throws gov.nasa.pds.imaging.generate.TemplateException, IOException, gov.nasa.pds.tools.LabelParserException
- Throws:
gov.nasa.pds.imaging.generate.TemplateExceptionIOExceptiongov.nasa.pds.tools.LabelParserException
-
generate
public static void generate(File target, File outputFile, String templateName, List<String> includePaths) throws gov.nasa.pds.imaging.generate.TemplateException, IOException, gov.nasa.pds.tools.LabelParserException
- Throws:
gov.nasa.pds.imaging.generate.TemplateExceptionIOExceptiongov.nasa.pds.tools.LabelParserException
-
getHDUIndex
public static int getHDUIndex(File fitsFile, int index) throws nom.tam.fits.FitsException, IOException
Gets the HDU index that corresponds to the given index.- Parameters:
fitsFile- The FITS file to look for HDUs.index- The desired index.- Returns:
- An HDU index that corresponds to the given index.
- Throws:
nom.tam.fits.FitsException- If an error occurred reading the FITS file.IOException- If the FITS file cannot be read.
-
getSupportedImages
public static List<gov.nasa.arc.pds.xml.generated.Array> getSupportedImages(List<gov.nasa.arc.pds.xml.generated.Array> arrays)
Returns a list of supported image objects.- Parameters:
arrays- A list of Array objects to filter.- Returns:
- A list of supported Array image objects.
-
getImageProperties
public static ImageProperties getImageProperties(File pds4Label) throws Exception
Gets image properties associated with the given PDS4 label.- Parameters:
pds4Label- A pds4 label to parse.- Returns:
- An ImageProperties object that contains some image information about the given label.
- Throws:
Exception- If an error occurred during the parsing process.
-
getImageProperties
public static ImageProperties getImageProperties(URL pds4Label) throws Exception
- Throws:
Exception
-
getFileFromURL
public static File getFileFromURL(URL url, File outputDir) throws Exception
- Throws:
Exception
-
getParent
public static URL getParent(URL url) throws MalformedURLException, URISyntaxException
-
-