????
| Current Path : /opt/ant/manual/api/org/apache/tools/ant/util/ |
| Current File : //opt/ant/manual/api/org/apache/tools/ant/util/LayoutPreservingProperties.html |
<!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 (version 1.7.0_03) on Tue May 22 06:24:55 CEST 2012 -->
<title>LayoutPreservingProperties (Apache Ant API)</title>
<meta name="date" content="2012-05-22">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="LayoutPreservingProperties (Apache Ant API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><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="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="../../../../../org/apache/tools/ant/util/KeepAliveOutputStream.html" title="class in org.apache.tools.ant.util"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/tools/ant/util/LazyFileOutputStream.html" title="class in org.apache.tools.ant.util"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/tools/ant/util/LayoutPreservingProperties.html" target="_top">Frames</a></li>
<li><a href="LayoutPreservingProperties.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All 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: </li>
<li>Nested | </li>
<li><a href="#fields_inherited_from_class_java.util.Properties">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </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">org.apache.tools.ant.util</div>
<h2 title="Class LayoutPreservingProperties" class="title">Class LayoutPreservingProperties</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>java.util.Dictionary<K,V></li>
<li>
<ul class="inheritance">
<li>java.util.Hashtable<java.lang.Object,java.lang.Object></li>
<li>
<ul class="inheritance">
<li>java.util.Properties</li>
<li>
<ul class="inheritance">
<li>org.apache.tools.ant.util.LayoutPreservingProperties</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">LayoutPreservingProperties</span>
extends java.util.Properties</pre>
<div class="block"><p>A Properties collection which preserves comments and whitespace
present in the input stream from which it was loaded.</p>
<p>The class defers the usual work of the <a href="http://java.sun.com/j2se/1.3/docs/api/java/util/Properties.html">java.util.Properties</a>
class to there, but it also keeps track of the contents of the
input stream from which it was loaded (if applicable), so that it can
write out the properties in as close a form as possible to the input.</p>
If no changes occur to property values, the output should be the same
as the input, except for the leading date stamp, as normal for a
properties file. Properties added are appended to the file. Properties
whose values are changed are changed in place. Properties that are
removed are excised. If the <code>removeComments</code> flag is set,
then the comments immediately preceding the property are also removed.</p>
<p>If a second set of properties is loaded into an existing set, the
lines of the second set are added to the end. Note however, that if a
property already stored is present in a stream subsequently loaded, then
that property is removed before the new value is set. For example,
consider the file</p>
<pre> # the first line
alpha=one
# the second line
beta=two</pre>
<p>This file is loaded, and then the following is also loaded into the
same <code>LayoutPreservingProperties</code> object</p>
<pre> # association
beta=band
# and finally
gamma=rays</pre>
</p>The resulting collection sequence of logical lines depends on whether
or not <code>removeComments</code> was set at the time the second stream
is loaded. If it is set, then the resulting list of lines is</p>
<pre> # the first line
alpha=one
# association
beta=band
# and finally
gamma=rays</pre>
<p>If the flag is not set, then the comment "the second line" is retained,
although the key-value pair <code>beta=two</code> is removed.</p></div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../serialized-form.html#org.apache.tools.ant.util.LayoutPreservingProperties">Serialized Form</a></dd></dl>
</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_java.util.Properties">
<!-- -->
</a>
<h3>Fields inherited from class java.util.Properties</h3>
<code>defaults</code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/tools/ant/util/LayoutPreservingProperties.html#LayoutPreservingProperties()">LayoutPreservingProperties</a></strong>()</code>
<div class="block">Create a new, empty, Properties collection, with no defaults.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/tools/ant/util/LayoutPreservingProperties.html#LayoutPreservingProperties(java.util.Properties)">LayoutPreservingProperties</a></strong>(java.util.Properties defaults)</code>
<div class="block">Create a new, empty, Properties collection, with the specified defaults.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/LayoutPreservingProperties.html#clear()">clear</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/LayoutPreservingProperties.html#clone()">clone</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/LayoutPreservingProperties.html#isRemoveComments()">isRemoveComments</a></strong>()</code>
<div class="block">Returns <code>true</code> if comments are removed along with
properties, or <code>false</code> otherwise.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/LayoutPreservingProperties.html#listLines(java.io.PrintStream)">listLines</a></strong>(java.io.PrintStream out)</code>
<div class="block">Echo the lines of the properties (including blanks and comments) to the
stream.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/LayoutPreservingProperties.html#load(java.io.InputStream)">load</a></strong>(java.io.InputStream inStream)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/LayoutPreservingProperties.html#put(java.lang.Object, java.lang.Object)">put</a></strong>(java.lang.Object key,
java.lang.Object value)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/LayoutPreservingProperties.html#remove(java.lang.Object)">remove</a></strong>(java.lang.Object key)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/LayoutPreservingProperties.html#saveAs(java.io.File)">saveAs</a></strong>(java.io.File dest)</code>
<div class="block">Save the properties to a file.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/LayoutPreservingProperties.html#setProperty(java.lang.String, java.lang.String)">setProperty</a></strong>(java.lang.String key,
java.lang.String value)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/LayoutPreservingProperties.html#setRemoveComments(boolean)">setRemoveComments</a></strong>(boolean val)</code>
<div class="block">Sets the behaviour for comments accompanying properties that
are being removed.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/util/LayoutPreservingProperties.html#store(java.io.OutputStream, java.lang.String)">store</a></strong>(java.io.OutputStream out,
java.lang.String header)</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.util.Properties">
<!-- -->
</a>
<h3>Methods inherited from class java.util.Properties</h3>
<code>getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, store, storeToXML, storeToXML, stringPropertyNames</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.util.Hashtable">
<!-- -->
</a>
<h3>Methods inherited from class java.util.Hashtable</h3>
<code>contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, putAll, rehash, size, toString, values</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>finalize, getClass, notify, notifyAll, 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="LayoutPreservingProperties()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>LayoutPreservingProperties</h4>
<pre>public LayoutPreservingProperties()</pre>
<div class="block">Create a new, empty, Properties collection, with no defaults.</div>
</li>
</ul>
<a name="LayoutPreservingProperties(java.util.Properties)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>LayoutPreservingProperties</h4>
<pre>public LayoutPreservingProperties(java.util.Properties defaults)</pre>
<div class="block">Create a new, empty, Properties collection, with the specified defaults.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>defaults</code> - the default property values</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="isRemoveComments()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isRemoveComments</h4>
<pre>public boolean isRemoveComments()</pre>
<div class="block">Returns <code>true</code> if comments are removed along with
properties, or <code>false</code> otherwise. If
<code>true</code>, then when a property is removed, the comment
preceding it in the original file is removed also.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd><code>true</code> if leading comments are removed when
a property is removed; <code>false</code> otherwise</dd></dl>
</li>
</ul>
<a name="setRemoveComments(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setRemoveComments</h4>
<pre>public void setRemoveComments(boolean val)</pre>
<div class="block">Sets the behaviour for comments accompanying properties that
are being removed. If <code>true</code>, then when a property
is removed, the comment preceding it in the original file is
removed also.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>val</code> - <code>true</code> if leading comments are to be
removed when a property is removed; <code>false</code>
otherwise</dd></dl>
</li>
</ul>
<a name="load(java.io.InputStream)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>load</h4>
<pre>public void load(java.io.InputStream inStream)
throws java.io.IOException</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>load</code> in class <code>java.util.Properties</code></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.io.IOException</code></dd></dl>
</li>
</ul>
<a name="put(java.lang.Object, java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>put</h4>
<pre>public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
throws java.lang.NullPointerException</pre>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code>put</code> in interface <code>java.util.Map<java.lang.Object,java.lang.Object></code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code>put</code> in class <code>java.util.Hashtable<java.lang.Object,java.lang.Object></code></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.NullPointerException</code></dd></dl>
</li>
</ul>
<a name="setProperty(java.lang.String, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setProperty</h4>
<pre>public java.lang.Object setProperty(java.lang.String key,
java.lang.String value)
throws java.lang.NullPointerException</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>setProperty</code> in class <code>java.util.Properties</code></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.NullPointerException</code></dd></dl>
</li>
</ul>
<a name="clear()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clear</h4>
<pre>public void clear()</pre>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code>clear</code> in interface <code>java.util.Map<java.lang.Object,java.lang.Object></code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code>clear</code> in class <code>java.util.Hashtable<java.lang.Object,java.lang.Object></code></dd>
</dl>
</li>
</ul>
<a name="remove(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>remove</h4>
<pre>public java.lang.Object remove(java.lang.Object key)</pre>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code>remove</code> in interface <code>java.util.Map<java.lang.Object,java.lang.Object></code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code>remove</code> in class <code>java.util.Hashtable<java.lang.Object,java.lang.Object></code></dd>
</dl>
</li>
</ul>
<a name="clone()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clone</h4>
<pre>public java.lang.Object clone()</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>clone</code> in class <code>java.util.Hashtable<java.lang.Object,java.lang.Object></code></dd>
</dl>
</li>
</ul>
<a name="listLines(java.io.PrintStream)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>listLines</h4>
<pre>public void listLines(java.io.PrintStream out)</pre>
<div class="block">Echo the lines of the properties (including blanks and comments) to the
stream.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>out</code> - the stream to write to</dd></dl>
</li>
</ul>
<a name="saveAs(java.io.File)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>saveAs</h4>
<pre>public void saveAs(java.io.File dest)
throws java.io.IOException</pre>
<div class="block">Save the properties to a file.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dest</code> - the file to write to</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.io.IOException</code></dd></dl>
</li>
</ul>
<a name="store(java.io.OutputStream, java.lang.String)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>store</h4>
<pre>public void store(java.io.OutputStream out,
java.lang.String header)
throws java.io.IOException</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>store</code> in class <code>java.util.Properties</code></dd>
<dt><span class="strong">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><a href="#skip-navbar_bottom" title="Skip navigation links"></a><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="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="../../../../../org/apache/tools/ant/util/KeepAliveOutputStream.html" title="class in org.apache.tools.ant.util"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/tools/ant/util/LazyFileOutputStream.html" title="class in org.apache.tools.ant.util"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/tools/ant/util/LayoutPreservingProperties.html" target="_top">Frames</a></li>
<li><a href="LayoutPreservingProperties.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All 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: </li>
<li>Nested | </li>
<li><a href="#fields_inherited_from_class_java.util.Properties">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>