@Override public void write( File output, Map<String, Object> options, Model model ) throws IOException { Objects.requireNonNull( output, "output cannot be null" ); Objects.requireNonNull( model, "model cannot be null" ); output.getParentFile().mkdirs(); write( WriterFactory.newXmlWriter( output ), options, model ); }
DefaultModelWriter writer = new DefaultModelWriter(); writer.write(buff, options, model);
@Override public Model read(final Reader input, final Map<String, ?> options) throws IOException { assert input != null; Model model; try { model = doRead(input, options); } catch (Throwable t) { t = StackTraceUtils.sanitize(t); if (t instanceof IOException) { throw (IOException) t; } if (t instanceof RuntimeException) { throw (RuntimeException) t; } if (t instanceof Error) { throw (Error) t; } throw new RuntimeException(t); } // FIXME: Looks like there are cases where the model is loaded more than once executeManager.install(model, options); if (log.isDebugEnabled()) { DefaultModelWriter writer = new DefaultModelWriter(); StringWriter buff = new StringWriter(); writer.write(buff, null, model); log.debug("Read groovy model: \n" + buff); } return model; }
DefaultModelWriter writer = new DefaultModelWriter(); writer.write(buff, options, model);
@Override public void write( OutputStream output, Map<String, Object> options, Model model ) throws IOException { Objects.requireNonNull( output, "output cannot be null" ); Objects.requireNonNull( model, "model cannot be null" ); String encoding = model.getModelEncoding(); // TODO Use StringUtils here if ( encoding == null || encoding.length() <= 0 ) { encoding = "UTF-8"; } try ( final Writer out = new OutputStreamWriter( output, encoding ) ) { write( out, options, model ); } }
@Override public Model read(final Reader input, final Map<String, ?> options) throws IOException { assert input != null; Model model; try { model = doRead(input, options); } catch (Throwable t) { t = StackTraceUtils.sanitize(t); if (t instanceof IOException) { throw (IOException) t; } if (t instanceof RuntimeException) { throw (RuntimeException) t; } if (t instanceof Error) { throw (Error) t; } throw new RuntimeException(t); } // FIXME: Looks like there are cases where the model is loaded more than once executeManager.install(model, options); if (log.isDebugEnabled()) { DefaultModelWriter writer = new DefaultModelWriter(); StringWriter buff = new StringWriter(); writer.write(buff, null, model); log.debug("Read groovy model: \n" + buff); } return model; }
@Override public void write( File output, Map<String, Object> options, Model model ) throws IOException { Objects.requireNonNull( output, "output cannot be null" ); Objects.requireNonNull( model, "model cannot be null" ); output.getParentFile().mkdirs(); write( WriterFactory.newXmlWriter( output ), options, model ); }
@Override public void write( OutputStream output, Map<String, Object> options, Model model ) throws IOException { Objects.requireNonNull( output, "output cannot be null" ); Objects.requireNonNull( model, "model cannot be null" ); String encoding = model.getModelEncoding(); // TODO Use StringUtils here if ( encoding == null || encoding.length() <= 0 ) { encoding = "UTF-8"; } try ( final Writer out = new OutputStreamWriter( output, encoding ) ) { write( out, options, model ); } }