if (input == null) {
throw new IllegalArgumentException(
JaiI18N.getString("TileDecoderImpl0"));
}
TileCodecDescriptor tcd =
TileCodecUtils.getTileCodecDescriptor("tileDecoder", formatName);
// If param is null, get the default parameter list.
if (param == null)
param = tcd.getDefaultParameters("tileDecoder");
if (param != null) {
// Check whether the formatName from the param is the same as the
// one supplied to this method.
if (param.getFormatName().equalsIgnoreCase(formatName) == false) {
throw new IllegalArgumentException(
JaiI18N.getString("TileDecoderImpl1"));
}
// Check whether the supplied parameterList supports the
// "tileDecoder" mode.
if (param.isValidForMode("tileDecoder") == false) {
throw new IllegalArgumentException(
JaiI18N.getString("TileDecoderImpl2"));
}
// Check whether the ParameterListDescriptors are the same.
if (param.getParameterListDescriptor().equals(
tcd.getParameterListDescriptor("tileDecoder")) == false)
throw new IllegalArgumentException(JaiI18N.getString("TileCodec0"));
SampleModel sm = null;
// Check whether a non-null samplemodel value is needed
if (tcd.includesSampleModelInfo() == false) {
try {
sm = (SampleModel)param.getObjectParameter("sampleModel");
} catch (IllegalArgumentException iae) {
// There is no parameter named sampleModel defined on the
// supplied parameter list
throw new IllegalArgumentException(
JaiI18N.getString("TileDecoderImpl3"));
}
if (sm == null ||
sm == ParameterListDescriptor.NO_PARAMETER_DEFAULT) {
if (tcd.getParameterListDescriptor("tileDecoder").
getParamDefaultValue("sampleModel") == null) {
// If a non-null value was not set on the parameter list
// and wasn't available thru the descriptor either
throw new IllegalArgumentException(
JaiI18N.getString("TileDecoderImpl4"));
}
}
}
} else {
// If the supplied parameterList is null and the default one is
// null too, then check whether this format supports no parameters
ParameterListDescriptor pld =
tcd.getParameterListDescriptor("tileDecoder");
// Check whether a non-null samplemodel value is needed
if (tcd.includesSampleModelInfo() == false) {
// SampleModel must be specified via the parameter list
throw new IllegalArgumentException(
JaiI18N.getString("TileDecoderImpl5"));
}