|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.esa.beam.framework.dataio.ProductIO
public class ProductIO
The ProductIO class provides several utility methods concerning data I/O for remote sensing data
products.
For example, a product can be read in using a single method call:
Product product = ProductIO.readProduct("test.prd");
and written out in a similar way:
ProductIO.writeProduct(product, "HDF5", "test.h5", null);
| Field Summary | |
|---|---|
static String |
DEFAULT_FORMAT_NAME
The name of the default product format. |
| Method Summary | |
|---|---|
static ProductReader |
getProductReader(String formatName)
Gets a product reader for the given format name. |
static ProductReader |
getProductReaderForFile(File file)
Deprecated. Since BEAM 4.10. Use getProductReaderForInput(Object) instead. |
static ProductReader |
getProductReaderForInput(Object input)
Tries to find a product reader instance suitable for the given input. |
static ProductWriter |
getProductWriter(String formatName)
Gets a product writer for the given format name. |
static String[] |
getProductWriterExtensions(String formatName)
Gets an array of writer product file extensions for the given format name. |
static Product |
readProduct(File file)
Reads the data product specified by the given file. |
static Product |
readProduct(File file,
String... formatNames)
Reads the data product specified by the given file. |
static Product |
readProduct(String filePath)
Reads the data product specified by the given file path. |
static void |
writeProduct(Product product,
File file,
String formatName,
boolean incremental)
Writes a product with the specified format to the given file. |
static void |
writeProduct(Product product,
File file,
String formatName,
boolean incremental,
com.bc.ceres.core.ProgressMonitor pm)
Writes a product with the specified format to the given file. |
static void |
writeProduct(Product product,
String filePath,
String formatName)
Writes a product with the specified format to the given file path. |
static void |
writeProduct(Product product,
String filePath,
String formatName,
com.bc.ceres.core.ProgressMonitor pm)
Writes a product with the specified format to the given file path. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_FORMAT_NAME
| Method Detail |
|---|
public static ProductReader getProductReader(String formatName)
formatName - the product format name
null if none was foundpublic static String[] getProductWriterExtensions(String formatName)
formatName - the format name
public static ProductWriter getProductWriter(String formatName)
formatName - the product format name
null if none was found
public static Product readProduct(File file,
String... formatNames)
throws IOException
The returned product will be associated with a reader capable of decoding the file (also
see Product.productReader).
If more than one appropriate reader exists in the registry, the returned product will be
associated with the reader which is the most preferred according to the product format names
supplied as last argument. If no reader capable of decoding the file is capable of handling
any of these product formats, the returned product will be associated with the first reader
found in the registry which is capable of decoding the file.
The method does not automatically load band raster data, so
Band.rasterData will always be null
for all bands in the product returned by this method.
file - the data product fileformatNames - a list of product format names defining the preference, if more than one reader
found in the registry is capable of decoding the file.
null,
if no appropriate reader was found for the given product file
IOException - if an I/O error occursreadProduct(String),
readProduct(File)
public static Product readProduct(String filePath)
throws IOException
The product returned will be associated with the reader appropriate for the given
file format (see also Product.productReader).
The method does not automatically read band data, thus
Band.rasterData will always be null
for all bands in the product returned by this method.
filePath - the data product file path
null if no
appropriate reader was found for the given product file
IOException - if an I/O error occursreadProduct(File)
public static Product readProduct(File file)
throws IOException
The product returned will be associated with the reader appropriate for the given
file format (see also Product.productReader).
The method does not automatically read band data, thus
Band.rasterData will always be null
for all bands in the product returned by this method.
file - the data product file
null if no
appropriate reader was found for the given product file
IOException - if an I/O error occursreadProduct(String)@Deprecated public static ProductReader getProductReaderForFile(File file)
getProductReaderForInput(Object) instead.
file - the file to decode.
null if the file cannot be decoded.public static ProductReader getProductReaderForInput(Object input)
null, if no
registered product reader can handle the given input value.
The input may be of any type, but most likely it will be a file path given by a String or
File value. Some readers may also directly support an ImageInputStream object.
input - the input object.
input or null if no registered reader can handle
the it.ProductReaderPlugIn.getDecodeQualification(Object),
ProductReader.readProductNodes(Object, ProductSubsetDef)
public static void writeProduct(Product product,
String filePath,
String formatName)
throws IOException
The method also writes all band data to the file. Therefore the band data must either
Band.rasterData is not null)Product.productReader is not null) so that unloaded data can be reloaded.
product - the product, must not be nullfilePath - the file pathformatName - the name of a supported product format, e.g. "HDF5". If null, the default format
"BEAM-DIMAP" will be used
IOException - if an IOException occurs
public static void writeProduct(Product product,
String filePath,
String formatName,
com.bc.ceres.core.ProgressMonitor pm)
throws IOException
The method also writes all band data to the file. Therefore the band data must either
Band.rasterData is not null)Product.productReader is not null) so that unloaded data can be reloaded.
product - the product, must not be nullfilePath - the file pathformatName - the name of a supported product format, e.g. "HDF5". If null, the default format
"BEAM-DIMAP" will be usedpm - a monitor to inform the user about progress
IOException - if an IOException occurs
public static void writeProduct(Product product,
File file,
String formatName,
boolean incremental)
throws IOException
The method also writes all band data to the file. Therefore the band data must either
Band.rasterData is not null)Product.productReader is not null) so that unloaded data can be reloaded.
product - the product, must not be nullfile - the product file , must not be nullformatName - the name of a supported product format, e.g. "HDF5". If null, the default format
"BEAM-DIMAP" will be usedincremental - switch the product writer in incremental mode or not.
IOException - if an IOException occurs
public static void writeProduct(Product product,
File file,
String formatName,
boolean incremental,
com.bc.ceres.core.ProgressMonitor pm)
throws IOException
The method also writes all band data to the file. Therefore the band data must either
Band.rasterData is not null)Product.productReader is not null) so that unloaded data can be reloaded.
product - the product, must not be nullfile - the product file , must not be nullformatName - the name of a supported product format, e.g. "HDF5". If null, the default format
"BEAM-DIMAP" will be usedincremental - switch the product writer in incremental mode or not.pm - a monitor to inform the user about progress
IOException - if an IOException occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||