public class IOUtils extends Object
Constructor and Description |
---|
IOUtils() |
Modifier and Type | Method and Description |
---|---|
static File |
askForFileForLoading(File file,
String title,
Frame parent,
Logger logger)
Prompts the user for a xml file to load from.
|
static File |
askForFileForSaving(File file,
Frame parent,
Logger logger)
Prompts the user for a xml file to save to.
|
static File |
askForFolder(File file,
String title,
Frame parent,
Logger logger)
Prompts the user for a target folder.
|
static boolean |
canReadFile(String path,
StringBuilder errorHolder) |
static void |
marshallMap(Map<String,Double> map,
org.jdom2.Element element)
Stores the given mapping in a given JDom element, using attributes in a
KEY="VALUE" fashion.
|
static boolean |
readBooleanAttribute(org.jdom2.Element element,
Map<String,Object> settings,
String parameterKey,
StringBuilder errorHolder) |
static boolean |
readBooleanAttribute(org.jdom2.Element element,
String name,
Logger logger) |
static boolean |
readBooleanAttribute(org.jdom2.Element element,
String name,
Logger logger,
boolean defaultValue) |
static boolean |
readDoubleAttribute(org.jdom2.Element element,
Map<String,Object> settings,
String parameterKey,
StringBuilder errorHolder) |
static double |
readDoubleAttribute(org.jdom2.Element element,
String name,
Logger logger) |
static double |
readDoubleAttribute(org.jdom2.Element element,
String name,
Logger logger,
double defaultValue) |
static double |
readFloatAttribute(org.jdom2.Element element,
String name,
Logger logger) |
static int |
readIntAttribute(org.jdom2.Element element,
String name,
Logger logger)
Read and return an integer attribute from a JDom
Element , and
substitute a default value of 0 if the attribute is not found or of the
wrong type. |
static int |
readIntAttribute(org.jdom2.Element element,
String name,
Logger logger,
int defaultValue) |
static boolean |
readIntegerAttribute(org.jdom2.Element element,
Map<String,Object> settings,
String parameterKey,
StringBuilder errorHolder) |
static boolean |
readStringAttribute(org.jdom2.Element element,
Map<String,Object> settings,
String parameterKey,
StringBuilder errorHolder) |
static boolean |
unmarshallMap(org.jdom2.Element element,
Map<String,Double> map,
StringBuilder errorHolder)
Unmarshall the attributes of a JDom element in a map of doubles.
|
static boolean |
writeAttribute(Map<String,Object> settings,
org.jdom2.Element element,
String parameterKey,
Class<?> expectedClass,
StringBuilder errorHolder)
Add a parameter attribute to the given element, taken from the given
settings map.
|
static boolean |
writeDoMedian(Map<String,Object> settings,
org.jdom2.Element element,
StringBuilder errorHolder) |
static boolean |
writeDoSubPixel(Map<String,Object> settings,
org.jdom2.Element element,
StringBuilder errorHolder) |
static boolean |
writeDownsamplingFactor(Map<String,Object> settings,
org.jdom2.Element element,
StringBuilder errorHolder) |
static boolean |
writeRadius(Map<String,Object> settings,
org.jdom2.Element element,
StringBuilder errorHolder) |
static boolean |
writeTargetChannel(Map<String,Object> settings,
org.jdom2.Element element,
StringBuilder errorHolder) |
static boolean |
writeThreshold(Map<String,Object> settings,
org.jdom2.Element element,
StringBuilder errorHolder) |
public static final boolean canReadFile(String path, StringBuilder errorHolder)
public static File askForFileForSaving(File file, Frame parent, Logger logger)
file
- a default file, will be used to display a default choice in
the file chooser.parent
- the Frame
to lock on this dialog. It can be
null
; in that case, native dialogs will not be
used on Macs.logger
- a Logger
to report what is happening.null
if the user pressed the
"cancel" button.public static File askForFileForLoading(File file, String title, Frame parent, Logger logger)
file
- a default file, will be used to display a default choice in
the file chooser.title
- the title to display on the file chooser windowparent
- the Frame
to lock on this dialog.logger
- a Logger
to report what is happening.null
if the user pressed the
"cancel" button.public static File askForFolder(File file, String title, Frame parent, Logger logger)
file
- a default file, will be used to display a default choice in
the file chooser.title
- the title to display on the file chooser windowparent
- the Frame
to lock on this dialog.logger
- a Logger
to report what is happening.null
if the user pressed the
"cancel" button.public static final int readIntAttribute(org.jdom2.Element element, String name, Logger logger)
Element
, and
substitute a default value of 0 if the attribute is not found or of the
wrong type.public static final int readIntAttribute(org.jdom2.Element element, String name, Logger logger, int defaultValue)
public static final double readFloatAttribute(org.jdom2.Element element, String name, Logger logger)
public static final double readDoubleAttribute(org.jdom2.Element element, String name, Logger logger)
public static final double readDoubleAttribute(org.jdom2.Element element, String name, Logger logger, double defaultValue)
public static final boolean readBooleanAttribute(org.jdom2.Element element, String name, Logger logger)
public static final boolean readBooleanAttribute(org.jdom2.Element element, String name, Logger logger, boolean defaultValue)
public static final boolean readDoubleAttribute(org.jdom2.Element element, Map<String,Object> settings, String parameterKey, StringBuilder errorHolder)
public static final boolean readIntegerAttribute(org.jdom2.Element element, Map<String,Object> settings, String parameterKey, StringBuilder errorHolder)
public static final boolean readBooleanAttribute(org.jdom2.Element element, Map<String,Object> settings, String parameterKey, StringBuilder errorHolder)
public static final boolean readStringAttribute(org.jdom2.Element element, Map<String,Object> settings, String parameterKey, StringBuilder errorHolder)
public static boolean unmarshallMap(org.jdom2.Element element, Map<String,Double> map, StringBuilder errorHolder)
true
if all values were found and mapped as doubles,
false
otherwise and the error holder is updated.public static final boolean writeTargetChannel(Map<String,Object> settings, org.jdom2.Element element, StringBuilder errorHolder)
public static final boolean writeRadius(Map<String,Object> settings, org.jdom2.Element element, StringBuilder errorHolder)
public static final boolean writeThreshold(Map<String,Object> settings, org.jdom2.Element element, StringBuilder errorHolder)
public static final boolean writeDoMedian(Map<String,Object> settings, org.jdom2.Element element, StringBuilder errorHolder)
public static final boolean writeDoSubPixel(Map<String,Object> settings, org.jdom2.Element element, StringBuilder errorHolder)
public static final boolean writeDownsamplingFactor(Map<String,Object> settings, org.jdom2.Element element, StringBuilder errorHolder)
public static final boolean writeAttribute(Map<String,Object> settings, org.jdom2.Element element, String parameterKey, Class<?> expectedClass, StringBuilder errorHolder)
settings
- the map to take the parameter value fromelement
- the JDom element to updateparameterKey
- the key to the parameter value in the mapexpectedClass
- the expected class for the valuetrue
if the parameter was found, of the right class,
and was successfully added to the element, false
if
not, and updated the specified error holder.Copyright © 2015–2021 Fiji. All rights reserved.