Package org.apache.maven.model.io
Class DefaultModelReader
- java.lang.Object
-
- org.apache.maven.model.io.DefaultModelReader
-
- All Implemented Interfaces:
ModelReader
@Named @Singleton public class DefaultModelReader extends java.lang.Object implements ModelReader
Handles deserialization of a model from some kind of textual format like XML.
-
-
Field Summary
-
Fields inherited from interface org.apache.maven.model.io.ModelReader
INPUT_SOURCE, IS_STRICT
-
-
Constructor Summary
Constructors Constructor Description DefaultModelReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private InputSourcegetSource(java.util.Map<java.lang.String,?> options)private booleanisStrict(java.util.Map<java.lang.String,?> options)Modelread(java.io.File input, java.util.Map<java.lang.String,?> options)Reads the model from the specified file.Modelread(java.io.InputStream input, java.util.Map<java.lang.String,?> options)Reads the model from the specified byte stream.private Modelread(java.io.Reader reader, boolean strict, InputSource source)Modelread(java.io.Reader input, java.util.Map<java.lang.String,?> options)Reads the model from the specified character reader.
-
-
-
Method Detail
-
read
public Model read(java.io.File input, java.util.Map<java.lang.String,?> options) throws java.io.IOException
Description copied from interface:ModelReaderReads the model from the specified file.- Specified by:
readin interfaceModelReader- Parameters:
input- The file to deserialize the model from, must not benull.options- The options to use for deserialization, may benullto use the default values.- Returns:
- The deserialized model, never
null. - Throws:
java.io.IOException- If the model could not be deserialized.ModelParseException- If the input format could not be parsed.
-
read
public Model read(java.io.Reader input, java.util.Map<java.lang.String,?> options) throws java.io.IOException
Description copied from interface:ModelReaderReads the model from the specified character reader. The reader will be automatically closed before the method returns.- Specified by:
readin interfaceModelReader- Parameters:
input- The reader to deserialize the model from, must not benull.options- The options to use for deserialization, may benullto use the default values.- Returns:
- The deserialized model, never
null. - Throws:
java.io.IOException- If the model could not be deserialized.ModelParseException- If the input format could not be parsed.
-
read
public Model read(java.io.InputStream input, java.util.Map<java.lang.String,?> options) throws java.io.IOException
Description copied from interface:ModelReaderReads the model from the specified byte stream. The stream will be automatically closed before the method returns.- Specified by:
readin interfaceModelReader- Parameters:
input- The stream to deserialize the model from, must not benull.options- The options to use for deserialization, may benullto use the default values.- Returns:
- The deserialized model, never
null. - Throws:
java.io.IOException- If the model could not be deserialized.ModelParseException- If the input format could not be parsed.
-
isStrict
private boolean isStrict(java.util.Map<java.lang.String,?> options)
-
getSource
private InputSource getSource(java.util.Map<java.lang.String,?> options)
-
read
private Model read(java.io.Reader reader, boolean strict, InputSource source) throws java.io.IOException
- Throws:
java.io.IOException
-
-