blob: 515fc8192f6299c38e31059e65a918bcf79a3b00 [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_191) on Sat Mar 16 23:00:50 CET 2019 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>StringUtilities (Apache MINA 2.0.0 API Documentation)</title>
<meta name="date" content="2019-03-16">
<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="StringUtilities (Apache MINA 2.0.0 API Documentation)";
}
}
catch(err) {
}
//-->
var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static 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/StringUtilities.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="../../../../../org/apache/mina/proxy/utils/MD4Provider.html" title="class in org.apache.mina.proxy.utils"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/mina/proxy/utils/StringUtilities.html" target="_top">Frames</a></li>
<li><a href="StringUtilities.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">org.apache.mina.proxy.utils</div>
<h2 title="Class StringUtilities" class="title">Class StringUtilities</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.mina.proxy.utils.StringUtilities</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">StringUtilities</span>
extends java.lang.Object</pre>
<div class="block">StringUtilities.java - Various methods to handle strings.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>MINA 2.0.0-M3</dd>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd><a href="http://mina.apache.org">Apache MINA Project</a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== 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="../../../../../org/apache/mina/proxy/utils/StringUtilities.html#StringUtilities--">StringUtilities</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="t1" class="tableTab"><span><a href="javascript:show(1);">Static 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>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/StringUtilities.html#addValueToHeader-java.util.Map-java.lang.String-java.lang.String-boolean-">addValueToHeader</a></span>(java.util.Map&lt;java.lang.String,java.util.List&lt;java.lang.String&gt;&gt;&nbsp;headers,
java.lang.String&nbsp;key,
java.lang.String&nbsp;value,
boolean&nbsp;singleValued)</code>
<div class="block">Adds an header to the provided map of headers.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/StringUtilities.html#copyDirective-java.util.HashMap-java.util.HashMap-java.lang.String-">copyDirective</a></span>(java.util.HashMap&lt;java.lang.String,java.lang.String&gt;&nbsp;src,
java.util.HashMap&lt;java.lang.String,java.lang.String&gt;&nbsp;dst,
java.lang.String&nbsp;directive)</code>
<div class="block">Copy the directive from the source map to the destination map, if it's
value isn't null.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/StringUtilities.html#copyDirective-java.util.HashMap-java.lang.StringBuilder-java.lang.String-">copyDirective</a></span>(java.util.HashMap&lt;java.lang.String,java.lang.String&gt;&nbsp;directives,
java.lang.StringBuilder&nbsp;sb,
java.lang.String&nbsp;directive)</code>
<div class="block">Copy the directive to the <code>StringBuilder</code> if not null.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/StringUtilities.html#getDirectiveValue-java.util.HashMap-java.lang.String-boolean-">getDirectiveValue</a></span>(java.util.HashMap&lt;java.lang.String,java.lang.String&gt;&nbsp;directivesMap,
java.lang.String&nbsp;directive,
boolean&nbsp;mandatory)</code>
<div class="block">A directive is a parameter of the digest authentication process.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/StringUtilities.html#getSingleValuedHeader-java.util.Map-java.lang.String-">getSingleValuedHeader</a></span>(java.util.Map&lt;java.lang.String,java.util.List&lt;java.lang.String&gt;&gt;&nbsp;headers,
java.lang.String&nbsp;key)</code>
<div class="block">Returns the value of the named header.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/StringUtilities.html#isLws-byte-">isLws</a></span>(byte&nbsp;b)</code>
<div class="block">Is character a linear white space ?</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>static java.util.HashMap&lt;java.lang.String,java.lang.String&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/StringUtilities.html#parseDirectives-byte:A-">parseDirectives</a></span>(byte[]&nbsp;buf)</code>
<div class="block">Parses digest-challenge string, extracting each token and value(s).</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/StringUtilities.html#stringTo8859_1-java.lang.String-">stringTo8859_1</a></span>(java.lang.String&nbsp;str)</code>
<div class="block">Used to convert username-value, passwd or realm to 8859_1 encoding
if all chars in string are within the 8859_1 (Latin 1) encoding range.</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="StringUtilities--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>StringUtilities</h4>
<pre>public&nbsp;StringUtilities()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getDirectiveValue-java.util.HashMap-java.lang.String-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDirectiveValue</h4>
<pre>public static&nbsp;java.lang.String&nbsp;getDirectiveValue(java.util.HashMap&lt;java.lang.String,java.lang.String&gt;&nbsp;directivesMap,
java.lang.String&nbsp;directive,
boolean&nbsp;mandatory)
throws javax.security.sasl.AuthenticationException</pre>
<div class="block">A directive is a parameter of the digest authentication process.
Returns the value of a directive from the map. If mandatory is true and the
value is null, then it throws an <code>AuthenticationException</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>directivesMap</code> - the directive's map</dd>
<dd><code>directive</code> - the name of the directive we want to retrieve</dd>
<dd><code>mandatory</code> - is the directive mandatory</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the mandatory value as a String</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>javax.security.sasl.AuthenticationException</code> - if mandatory is true and if
directivesMap.get(directive) == null</dd>
</dl>
</li>
</ul>
<a name="copyDirective-java.util.HashMap-java.lang.StringBuilder-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>copyDirective</h4>
<pre>public static&nbsp;void&nbsp;copyDirective(java.util.HashMap&lt;java.lang.String,java.lang.String&gt;&nbsp;directives,
java.lang.StringBuilder&nbsp;sb,
java.lang.String&nbsp;directive)</pre>
<div class="block">Copy the directive to the <code>StringBuilder</code> if not null.
(A directive is a parameter of the digest authentication process.)</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>directives</code> - the directives map</dd>
<dd><code>sb</code> - the output buffer</dd>
<dd><code>directive</code> - the directive name to look for</dd>
</dl>
</li>
</ul>
<a name="copyDirective-java.util.HashMap-java.util.HashMap-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>copyDirective</h4>
<pre>public static&nbsp;java.lang.String&nbsp;copyDirective(java.util.HashMap&lt;java.lang.String,java.lang.String&gt;&nbsp;src,
java.util.HashMap&lt;java.lang.String,java.lang.String&gt;&nbsp;dst,
java.lang.String&nbsp;directive)</pre>
<div class="block">Copy the directive from the source map to the destination map, if it's
value isn't null.
(A directive is a parameter of the digest authentication process.)</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>src</code> - the source map</dd>
<dd><code>dst</code> - the destination map</dd>
<dd><code>directive</code> - the directive name</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the value of the copied directive</dd>
</dl>
</li>
</ul>
<a name="parseDirectives-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parseDirectives</h4>
<pre>public static&nbsp;java.util.HashMap&lt;java.lang.String,java.lang.String&gt;&nbsp;parseDirectives(byte[]&nbsp;buf)
throws javax.security.sasl.SaslException</pre>
<div class="block">Parses digest-challenge string, extracting each token and value(s). Each token
is a directive.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buf</code> - A non-null digest-challenge string.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.UnsupportedEncodingException</code></dd>
<dd><code>javax.security.sasl.SaslException</code> - if the String cannot be parsed according to RFC 2831</dd>
</dl>
</li>
</ul>
<a name="isLws-byte-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isLws</h4>
<pre>public static&nbsp;boolean&nbsp;isLws(byte&nbsp;b)</pre>
<div class="block">Is character a linear white space ?
LWS = [CRLF] 1*( SP | HT )
Note that we're checking individual bytes instead of CRLF</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>b</code> - the byte to check</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if it's a linear white space</dd>
</dl>
</li>
</ul>
<a name="stringTo8859_1-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>stringTo8859_1</h4>
<pre>public static&nbsp;java.lang.String&nbsp;stringTo8859_1(java.lang.String&nbsp;str)
throws java.io.UnsupportedEncodingException</pre>
<div class="block">Used to convert username-value, passwd or realm to 8859_1 encoding
if all chars in string are within the 8859_1 (Latin 1) encoding range.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>str</code> - a non-null String</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a non-null String containing the 8859_1 encoded string</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>javax.security.sasl.AuthenticationException</code></dd>
<dd><code>java.io.UnsupportedEncodingException</code></dd>
</dl>
</li>
</ul>
<a name="getSingleValuedHeader-java.util.Map-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSingleValuedHeader</h4>
<pre>public static&nbsp;java.lang.String&nbsp;getSingleValuedHeader(java.util.Map&lt;java.lang.String,java.util.List&lt;java.lang.String&gt;&gt;&nbsp;headers,
java.lang.String&nbsp;key)</pre>
<div class="block">Returns the value of the named header. If it has multiple values
then an <code>IllegalArgumentException</code> is thrown</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>headers</code> - the http headers map</dd>
<dd><code>key</code> - the key of the header</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the value of the http header</dd>
</dl>
</li>
</ul>
<a name="addValueToHeader-java.util.Map-java.lang.String-java.lang.String-boolean-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>addValueToHeader</h4>
<pre>public static&nbsp;void&nbsp;addValueToHeader(java.util.Map&lt;java.lang.String,java.util.List&lt;java.lang.String&gt;&gt;&nbsp;headers,
java.lang.String&nbsp;key,
java.lang.String&nbsp;value,
boolean&nbsp;singleValued)</pre>
<div class="block">Adds an header to the provided map of headers.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>headers</code> - the http headers map</dd>
<dd><code>key</code> - the name of the new header to add</dd>
<dd><code>value</code> - the value of the added header</dd>
<dd><code>singleValued</code> - if true and the map already contains one value
then it is replaced by the new value. Otherwise it simply adds a new
value to this multi-valued header.</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/StringUtilities.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="../../../../../org/apache/mina/proxy/utils/MD4Provider.html" title="class in org.apache.mina.proxy.utils"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/mina/proxy/utils/StringUtilities.html" target="_top">Frames</a></li>
<li><a href="StringUtilities.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 ======= -->
<p class="legalCopy"><small>Copyright &#169; 2004-2019 <a href="http://mina.apache.org/">Apache MINA Project</a>. All Rights Reserved.</small></p>
</body>
</html>