blob: e449d8aaad1d5211336b455d8d5da4dd5b8fac4f [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_281) on Sun Jan 15 15:58:35 CET 2023 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>NormalizeNewlines (FreeMarker 2.3.32 API)</title>
<meta name="date" content="2023-01-15">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="NormalizeNewlines (FreeMarker 2.3.32 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/NormalizeNewlines.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../freemarker/template/utility/JythonRuntime.html" title="class in freemarker.template.utility"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../freemarker/template/utility/NullArgumentException.html" title="class in freemarker.template.utility"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?freemarker/template/utility/NormalizeNewlines.html" target="_top">Frames</a></li>
<li><a href="NormalizeNewlines.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">freemarker.template.utility</div>
<h2 title="Class NormalizeNewlines" class="title">Class NormalizeNewlines</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>freemarker.template.utility.NormalizeNewlines</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a>, <a href="../../../freemarker/template/TemplateTransformModel.html" title="interface in freemarker.template">TemplateTransformModel</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="typeNameLabel">NormalizeNewlines</span>
extends java.lang.Object
implements <a href="../../../freemarker/template/TemplateTransformModel.html" title="interface in freemarker.template">TemplateTransformModel</a></pre>
<div class="block"><p>Transformer that supports FreeMarker legacy behavior: all newlines appearing
within the transformed area will be transformed into the platform's default
newline. Unlike the old behavior, however, newlines generated by the data
model are also converted. Legacy behavior was to leave newlines in the
data model unaltered.</p>
<p>Usage:<br>
From java:</p>
<pre>
SimpleHash root = new SimpleHash();
root.put( "normalizeNewlines", new freemarker.template.utility.NormalizeNewlines() );
...
</pre>
<p>From your FreeMarker template:</p>
<pre>
&lt;transform normalizeNewlines&gt;
&lt;html&gt;
&lt;head&gt;
...
&lt;p&gt;This template has all newlines normalized to the current platform's
default.&lt;/p&gt;
...
&lt;/body&gt;
&lt;/html&gt;
&lt;/transform&gt;
</pre></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.freemarker.template.TemplateModel">
<!-- -->
</a>
<h3>Fields inherited from interface&nbsp;freemarker.template.<a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a></h3>
<code><a href="../../../freemarker/template/TemplateModel.html#NOTHING">NOTHING</a></code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/NormalizeNewlines.html#NormalizeNewlines--">NormalizeNewlines</a></span>()</code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>java.io.Writer</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/NormalizeNewlines.html#getWriter-java.io.Writer-java.util.Map-">getWriter</a></span>(java.io.Writer&nbsp;out,
java.util.Map&nbsp;args)</code>
<div class="block">Returns a writer that will be used by the engine to feed the transformation input to the transform.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/NormalizeNewlines.html#transform-java.io.Reader-java.io.Writer-">transform</a></span>(java.io.Reader&nbsp;in,
java.io.Writer&nbsp;out)</code>
<div class="block">Performs newline normalization on FreeMarker output.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="NormalizeNewlines--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>NormalizeNewlines</h4>
<pre>public&nbsp;NormalizeNewlines()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getWriter-java.io.Writer-java.util.Map-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getWriter</h4>
<pre>public&nbsp;java.io.Writer&nbsp;getWriter(java.io.Writer&nbsp;out,
java.util.Map&nbsp;args)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="../../../freemarker/template/TemplateTransformModel.html#getWriter-java.io.Writer-java.util.Map-">TemplateTransformModel</a></code></span></div>
<div class="block">Returns a writer that will be used by the engine to feed the transformation input to the transform. Each call to
this method must return a new instance of the writer so that the transformation is thread-safe.
<p>
This method should not throw <code>RuntimeException</code>, nor <code>IOException</code> that wasn't caused by writing to
the output. Such exceptions should be catched inside the method and wrapped inside a
<a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template"><code>TemplateModelException</code></a>. (Note that setting <a href="../../../freemarker/template/Configuration.html#setWrapUncheckedExceptions-boolean-"><code>Configuration.setWrapUncheckedExceptions(boolean)</code></a> to
<code>true</code> can mitigate the negative effects of implementations that throw <code>RuntimeException</code>-s.)</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../freemarker/template/TemplateTransformModel.html#getWriter-java.io.Writer-java.util.Map-">getWriter</a></code>&nbsp;in interface&nbsp;<code><a href="../../../freemarker/template/TemplateTransformModel.html" title="interface in freemarker.template">TemplateTransformModel</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>out</code> - the character stream to which to write the transformed output</dd>
<dd><code>args</code> - the arguments (if any) passed to the transformation as a map of key/value pairs where the keys are
strings and the arguments are <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> instances. This is never <code>null</code>. (If you
need to convert the template models to POJOs, you can use the utility methods in the
<a href="../../../freemarker/template/utility/DeepUnwrap.html" title="class in freemarker.template.utility"><code>DeepUnwrap</code></a> class. Though it's recommended to work with <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a>-s directly.)</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The <code>Writer</code> to which the engine will write the content to transform, or <code>null</code> if the
transform does not support nested content (body). The returned <code>Writer</code> may implements the
<a href="../../../freemarker/template/TransformControl.html" title="interface in freemarker.template"><code>TransformControl</code></a> interface if it needs advanced control over the evaluation of the nested
content. FreeMarker will call <code>Writer.close()</code> after the transform end-tag. <code>Writer.close()</code>
must not close the <code>Writer</code> received as the <code>out</code> parameter (so if you are using a
<code>FilterWriter</code>, you must override <code>FilterWriter.close()</code>, as by default that closes the
wrapped <code>Writer</code>). Since 2.3.27 its also allowed to return the <code>out</code> writer as is, in which
case it won't be closed.</dd>
</dl>
</li>
</ul>
<a name="transform-java.io.Reader-java.io.Writer-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>transform</h4>
<pre>public&nbsp;void&nbsp;transform(java.io.Reader&nbsp;in,
java.io.Writer&nbsp;out)
throws java.io.IOException</pre>
<div class="block">Performs newline normalization on FreeMarker output.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>in</code> - the input to be transformed</dd>
<dd><code>out</code> - the destination of the transformation</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/NormalizeNewlines.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../freemarker/template/utility/JythonRuntime.html" title="class in freemarker.template.utility"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../freemarker/template/utility/NullArgumentException.html" title="class in freemarker.template.utility"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?freemarker/template/utility/NormalizeNewlines.html" target="_top">Frames</a></li>
<li><a href="NormalizeNewlines.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>