public final class StreamValidator extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
StreamValidator.Validator |
Constructor and Description |
---|
StreamValidator() |
Modifier and Type | Method and Description |
---|---|
void |
addValidator(String pName,
StreamValidator.Validator pValidator)
Add a new validator and sort the validators in ascending name order.
|
boolean |
getAllowUnknowns()
true if this StreamValidator should allow unknown resource types, false otherwise.
|
String |
getTypeNameFor(String pResourceName)
A descriptive type name for the given resource.
|
StreamValidator.Validator |
getValidatorFor(String pResourceName) |
void |
setAllowUnknowns(boolean pAllowUnknowns) |
InputStream |
validate(String pResourceName,
Map<String,String> pTemplateMap,
InputStream pInputStream)
Find the first validator which matches the resource name and return a stream which performs validation
on the given input stream.
|
public void addValidator(String pName, StreamValidator.Validator pValidator)
pName
- A name of the validatorpValidator
- The validatorpublic InputStream validate(String pResourceName, Map<String,String> pTemplateMap, InputStream pInputStream) throws ValidationException
pResourceName
- The name of the resource being validatedpTemplateMap
- a map holding place holder values supported in the publication resources.pInputStream
- The stream of data where the resource can be read @return The original input stream, or a filtered input stream wrapping and validating the original resource.ValidationException
- if no Validator accepted the resource and allowUnknowns is false.public StreamValidator.Validator getValidatorFor(String pResourceName)
public void setAllowUnknowns(boolean pAllowUnknowns)
public boolean getAllowUnknowns()
public String getTypeNameFor(String pResourceName)
StreamValidator.Validator.getResourceType()
for more informationpResourceName
- The resource name (uri) for which the type name will be returned© 1998- 2021 Escenic AS