Documentation of 'edu.wisc.ssec.mcidas.AreaFileFactory' Java class
AreaFileFactory
edu.wisc.ssec.mcidas

Class AreaFileFactory



  • public final class AreaFileFactory
    extends java.lang.Object
    Utility class for creating AreaFile instances. This class handles subsetting local files using urls whereas the AreaFile constructors do not.

    No instances of this class can be created.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.String calIntToStr(int cal)
      Calibration int to string.
      static int calStrToInt(java.lang.String cal)
      String to calibration int.
      static void copyAreaFile(java.lang.String source, java.lang.String outputFile)
      Copy an area file from one place to another
      static void copyAreaFile(java.lang.String source, java.lang.String outputFile, boolean verbose)
      Copy an area file from one place to another
      static AreaFile getAreaFileInstance(java.lang.String src)
      Create an initialized AreaFile instance.
      static AreaFile getAreaFileInstance(java.lang.String fpath, int startLine, int numLines, int lineMag, int startElem, int numEles, int eleMag, int band)
      static AreaFile getAreaFileInstance(java.net.URL url)
      Create an initialized AreaFile instance.
      static java.lang.String makeLocalQuery(int sl, int nl, int lm, int se, int ne, int em, int b)
      Construct a url query string for subsetting a local file.
      static java.lang.String makeLocalQuery(int sl, int nl, int lm, int se, int ne, int em, int b, int c)
      Construct a url query string for subsetting a local file.
      static java.lang.String makeLocalQuery(int sl, int nl, int lm, int se, int ne, int em, int b, java.lang.String c)
      Construct a url query string for subsetting a local file.
      static java.net.URL makeLocalSubsetURL(java.lang.String fpath, int sl, int nl, int lm, int se, int ne, int em, int b, java.lang.String u)
      Construct a URL for subsetting a local file.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • calStrToInt

        public static final int calStrToInt(java.lang.String cal)
        String to calibration int.
        Parameters:
        cal - calibration type string
        Returns:
        calibration type integer, Calibrator.CAL_NONE if unknown
      • calIntToStr

        public static final java.lang.String calIntToStr(int cal)
        Calibration int to string.
        Parameters:
        cal - calibration type
        Returns:
        calibration type string, raw if unknown
      • makeLocalQuery

        public static final java.lang.String makeLocalQuery(int sl,
                                                            int nl,
                                                            int lm,
                                                            int se,
                                                            int ne,
                                                            int em,
                                                            int b)
        Construct a url query string for subsetting a local file.
        Parameters:
        sl - starting line number.
        nl - number of lines.
        lm - line magnification.
        se - starting element.
        ne - number of elements.
        em - element magnification.
        b - band number.
        Returns:
        "?band=B&linele=SL SE&size=NL NE&mag=LM EM"
      • makeLocalQuery

        public static final java.lang.String makeLocalQuery(int sl,
                                                            int nl,
                                                            int lm,
                                                            int se,
                                                            int ne,
                                                            int em,
                                                            int b,
                                                            int c)
        Construct a url query string for subsetting a local file.
        Parameters:
        sl - starting line number.
        nl - number of lines.
        lm - line magnification.
        se - starting element.
        ne - number of elements.
        em - element magnification.
        b - band number.
        c - calibration type
        Returns:
        "?band=B&linele=SL SE&size=NL NE&mag=LM EM"&unit=C;
      • makeLocalQuery

        public static final java.lang.String makeLocalQuery(int sl,
                                                            int nl,
                                                            int lm,
                                                            int se,
                                                            int ne,
                                                            int em,
                                                            int b,
                                                            java.lang.String c)
        Construct a url query string for subsetting a local file.
        Parameters:
        sl - starting line number.
        nl - number of lines.
        lm - line magnification.
        se - starting element.
        ne - number of elements.
        em - element magnification.
        b - band number.
        c - calibration type as a string
        Returns:
        "?band=B&linele=SL SE&size=NL NE&mag=LM EM"&unit=C;
      • makeLocalSubsetURL

        public static final java.net.URL makeLocalSubsetURL(java.lang.String fpath,
                                                            int sl,
                                                            int nl,
                                                            int lm,
                                                            int se,
                                                            int ne,
                                                            int em,
                                                            int b,
                                                            java.lang.String u)
                                                     throws java.net.MalformedURLException
        Construct a URL for subsetting a local file.
        Parameters:
        fpath - canonical path to an area file.
        sl - starting line number.
        nl - number of lines.
        lm - line magnification.
        se - starting element.
        ne - number of elements.
        em - element magnification.
        b - band number.
        u - calibration unit
        Returns:
        a string of the format "file://FPATH?band=B& linele=SL SE&size=NL NE&mag=LM EM"&unit=U
        Throws:
        java.net.MalformedURLException - bad URL specification
      • getAreaFileInstance

        public static final AreaFile getAreaFileInstance(java.lang.String src)
                                                  throws AreaFileException,
                                                         AddeURLException
        Create an initialized AreaFile instance. First, an attempt is made to create a URL from src, if an error occurrs, meaning src is not a valid url, src is interpreted as a file path.
        Parameters:
        src - A relative or canonical path to a local file as a string or a string representation of a url appropriate for creating an AreaFile instance. For more information on urls appropriate for creating AreaFile instances see getAreaFileInstance(URL).

        URLs containing encoded characters in their query strings will be decoded before parsing.

        Returns:
        an initialized, possibly subsetted, instance
        Throws:
        AreaFileException - on any error constructing the instance.
        AddeURLException - If the source is a URL and the query string is not formatted correctly.
      • getAreaFileInstance

        public static final AreaFile getAreaFileInstance(java.net.URL url)
                                                  throws AddeURLException,
                                                         AreaFileException
        Create an initialized AreaFile instance.

        A url appropriate for creating an instance will have a protocol of either adde for remote ADDE data or file for files on the local disk. Information on consructing ADDE urls can be found in the AddeURLConnection class.

        A local file url may either be a standard file url such as file:///<absolute file path> or it may specify subsetting information. If specifying subsetting information, the url can contain the following parameters from the ADDE image data url specification with the specified defaults:

         NAME      DEFAULT
         linele  - 0 0 a  Must be used with size.
                          NOTE: only type 'a' is supported at this time
         size    - 0 0    Must be used with linele.
         mag     - 1 1    Only with linele and size, but not required.
         band    - 1      Can be used separately, not required.
         unit    - RAW    Calibration type
         
        A file url might look like:
         file://<abs file path>?linele=10 10&band=3&mag=-2 -4&size=500 500&unit=BRIT
         

        URLs containing encoded characters in their query strings will be decoded before parsing.

        Parameters:
        url - - the url as described above
        Returns:
        an initialized, possibly subsetted, instance
        Throws:
        AreaFileException - on any error constructing the instance.
        AddeURLException - if the query string is not a valid ADDE query stirng.
      • getAreaFileInstance

        public static final AreaFile getAreaFileInstance(java.lang.String fpath,
                                                         int startLine,
                                                         int numLines,
                                                         int lineMag,
                                                         int startElem,
                                                         int numEles,
                                                         int eleMag,
                                                         int band)
                                                  throws AreaFileException
        Parameters:
        fpath - the path to the file
        startLine - the starting image line
        numLines - the total number of lines to return
        lineMag - the line magnification. Valid values are >= -1. -1, 0, and 1 are all taken to be full line resolution, 2 is every other line, 3 every third, etc...
        startElem - the starting image element
        numEles - the total number of elements to return
        eleMag - the element magnification. Valid values are >= -1. -1, 0, and 1 are all taken to be full element resolution, 2 is every other element, 3 every third, etc...
        band - the 1-based band number for the subset, which must be present in the directory blocks band map or -1 for the first band
        Returns:
        the AreaFile instance
        Throws:
        AreaFileException
      • copyAreaFile

        public static void copyAreaFile(java.lang.String source,
                                        java.lang.String outputFile)
                                 throws AddeURLException,
                                        AreaFileException
        Copy an area file from one place to another
        Parameters:
        source - source file or ADDE url
        outputFile - name of the output file
        Throws:
        AreaFileException - on any error constructing the instance.
        AddeURLException - If the source is a URL and the query string is not formatted correctly.
      • copyAreaFile

        public static void copyAreaFile(java.lang.String source,
                                        java.lang.String outputFile,
                                        boolean verbose)
                                 throws AddeURLException,
                                        AreaFileException
        Copy an area file from one place to another
        Parameters:
        source - source file or ADDE url
        outputFile - name of the output file
        verbose - true to print out status messages
        Throws:
        AreaFileException - on any error constructing the instance.
        AddeURLException - If the source is a URL and the query string is not formatted correctly.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.