public final class AreaFileFactory extends Object
AreaFile
instances. This class
handles subsetting local files using urls whereas the AreaFile
constructors do not.
No instances of this class can be created.
Modifier and Type | Method and Description |
---|---|
static String |
calIntToStr(int cal)
Calibration int to string.
|
static int |
calStrToInt(String cal)
String to calibration int.
|
static void |
copyAreaFile(String source,
String outputFile)
Copy an area file from one place to another
|
static void |
copyAreaFile(String source,
String outputFile,
boolean verbose)
Copy an area file from one place to another
|
static AreaFile |
getAreaFileInstance(String src)
Create an initialized
AreaFile instance. |
static AreaFile |
getAreaFileInstance(String fpath,
int startLine,
int numLines,
int lineMag,
int startElem,
int numEles,
int eleMag,
int band)
|
static AreaFile |
getAreaFileInstance(URL url)
Create an initialized
AreaFile instance. |
static 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 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 String |
makeLocalQuery(int sl,
int nl,
int lm,
int se,
int ne,
int em,
int b,
String c)
Construct a url query string for subsetting a local file.
|
static URL |
makeLocalSubsetURL(String fpath,
int sl,
int nl,
int lm,
int se,
int ne,
int em,
int b,
String u)
Construct a
URL for subsetting a local file. |
public static final int calStrToInt(String cal)
cal
- calibration type stringpublic static final String calIntToStr(int cal)
cal
- calibration typepublic static final String makeLocalQuery(int sl, int nl, int lm, int se, int ne, int em, int b)
sl
- starting line number.nl
- number of lines.lm
- line magnification.se
- starting element.ne
- number of elements.em
- element magnification.b
- band number.public static final String makeLocalQuery(int sl, int nl, int lm, int se, int ne, int em, int b, int c)
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 typepublic static final String makeLocalQuery(int sl, int nl, int lm, int se, int ne, int em, int b, String c)
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 stringpublic static final URL makeLocalSubsetURL(String fpath, int sl, int nl, int lm, int se, int ne, int em, int b, String u) throws MalformedURLException
URL
for subsetting a local file.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"file://FPATH?band=B&
linele=SL SE&size=NL NE&mag=LM EM"&unit=U
MalformedURLException
- bad URL specificationpublic static final AreaFile getAreaFileInstance(String src) throws AreaFileException, AddeURLException
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.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.
AreaFileException
- on any error constructing the instance.AddeURLException
- If the source is a URL and the query string is
not formatted correctly.public static final AreaFile getAreaFileInstance(URL url) throws AddeURLException, AreaFileException
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 typeA 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.
url
- - the url as described aboveAreaFileException
- on any error constructing the instance.AddeURLException
- if the query string is not a valid ADDE query
stirng.public static final AreaFile getAreaFileInstance(String fpath, int startLine, int numLines, int lineMag, int startElem, int numEles, int eleMag, int band) throws AreaFileException
fpath
- the path to the filestartLine
- the starting image linenumLines
- the total number of lines to returnlineMag
- 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 elementnumEles
- the total number of elements to returneleMag
- 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 bandAreaFileException
public static void copyAreaFile(String source, String outputFile) throws AddeURLException, AreaFileException
source
- source file or ADDE urloutputFile
- name of the output fileAreaFileException
- on any error constructing the instance.AddeURLException
- If the source is a URL and the query string is
not formatted correctly.public static void copyAreaFile(String source, String outputFile, boolean verbose) throws AddeURLException, AreaFileException
source
- source file or ADDE urloutputFile
- name of the output fileverbose
- true to print out status messagesAreaFileException
- on any error constructing the instance.AddeURLException
- If the source is a URL and the query string is
not formatted correctly.Copyright © 1996–2023 The SSEC Visualization Project. All rights reserved.