blob: 45a306501cf465dc43ae524c184ff664d0b25733 [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:36 CET 2023 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>StandardCompress (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="StandardCompress (FreeMarker 2.3.32 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":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/StandardCompress.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/SecurityUtilities.html" title="class in freemarker.template.utility"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../freemarker/template/utility/StringUtil.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/StandardCompress.html" target="_top">Frames</a></li>
<li><a href="StandardCompress.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><a href="#field.summary">Field</a>&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><a href="#field.detail">Field</a>&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 StandardCompress" class="title">Class StandardCompress</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>freemarker.template.utility.StandardCompress</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">StandardCompress</span>
extends java.lang.Object
implements <a href="../../../freemarker/template/TemplateTransformModel.html" title="interface in freemarker.template">TemplateTransformModel</a></pre>
<div class="block"><p>A filter that compresses each sequence of consecutive whitespace
to a single line break (if the sequence contains a line break) or a
single space. In addition, leading and trailing whitespace is
completely removed.</p>
<p>Specify the transform parameter <code>single_line = true</code>
to always compress to a single space instead of a line break.</p>
<p>The default buffer size can be overridden by specifying a
<code>buffer_size</code> transform parameter (in bytes).</p>
<p><b>Note:</b> The compress tag is implemented using this filter</p>
<p>Usage:<br>
From java:</p>
<pre>
SimpleHash root = new SimpleHash();
root.put( "standardCompress", new freemarker.template.utility.StandardCompress() );
...
</pre>
<p>From your FreeMarker template:</p>
<pre>
&lt;transform standardCompress&gt;
&lt;p&gt;This paragraph will have
extraneous
whitespace removed.&lt;/p&gt;
&lt;/transform&gt;
</pre>
<p>Output:</p>
<pre>
&lt;p&gt;This paragraph will have
extraneous
whitespace removed.&lt;/p&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>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../freemarker/template/utility/StandardCompress.html" title="class in freemarker.template.utility">StandardCompress</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/StandardCompress.html#INSTANCE">INSTANCE</a></span></code>&nbsp;</td>
</tr>
</table>
<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/StandardCompress.html#StandardCompress--">StandardCompress</a></span>()</code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../freemarker/template/utility/StandardCompress.html#StandardCompress-int-">StandardCompress</a></span>(int&nbsp;defaultBufferSize)</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/StandardCompress.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>
</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">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="INSTANCE">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>INSTANCE</h4>
<pre>public static final&nbsp;<a href="../../../freemarker/template/utility/StandardCompress.html" title="class in freemarker.template.utility">StandardCompress</a> INSTANCE</pre>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="StandardCompress--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>StandardCompress</h4>
<pre>public&nbsp;StandardCompress()</pre>
</li>
</ul>
<a name="StandardCompress-int-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>StandardCompress</h4>
<pre>public&nbsp;StandardCompress(int&nbsp;defaultBufferSize)</pre>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>defaultBufferSize</code> - the default amount of characters to buffer</dd>
</dl>
</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="blockListLast">
<li class="blockList">
<h4>getWriter</h4>
<pre>public&nbsp;java.io.Writer&nbsp;getWriter(java.io.Writer&nbsp;out,
java.util.Map&nbsp;args)
throws <a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></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>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></code> - If any problem occurs that's not an <code>IOException</code> during writing the template output.</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/StandardCompress.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/SecurityUtilities.html" title="class in freemarker.template.utility"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../freemarker/template/utility/StringUtil.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/StandardCompress.html" target="_top">Frames</a></li>
<li><a href="StandardCompress.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><a href="#field.summary">Field</a>&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><a href="#field.detail">Field</a>&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>