Interface ModelWriter

  • All Known Implementing Classes:
    DefaultModelWriter

    public interface ModelWriter
    Handles serialization of a model into some kind of textual format like XML.
    Author:
    Benjamin Bentmann
    • Method Detail

      • write

        void write​(File output,
                   Map<String,​Object> options,
                   Model model)
            throws IOException
        Writes the supplied model to the specified file. Any non-existing parent directories of the output file will be created automatically.
        Parameters:
        output - The file to serialize the model to, must not be null.
        options - The options to use for serialization, may be null to use the default values.
        model - The model to serialize, must not be null.
        Throws:
        IOException - If the model could not be serialized.
      • write

        void write​(Writer output,
                   Map<String,​Object> options,
                   Model model)
            throws IOException
        Writes the supplied model to the specified character writer. The writer will be automatically closed before the method returns.
        Parameters:
        output - The writer to serialize the model to, must not be null.
        options - The options to use for serialization, may be null to use the default values.
        model - The model to serialize, must not be null.
        Throws:
        IOException - If the model could not be serialized.
      • write

        void write​(OutputStream output,
                   Map<String,​Object> options,
                   Model model)
            throws IOException
        Writes the supplied model to the specified byte stream. The stream will be automatically closed before the method returns.
        Parameters:
        output - The stream to serialize the model to, must not be null.
        options - The options to use for serialization, may be null to use the default values.
        model - The model to serialize, must not be null.
        Throws:
        IOException - If the model could not be serialized.