You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-dev@james.apache.org by ba...@apache.org on 2006/08/27 20:20:43 UTC
svn commit: r437432 [29/34] - in /james/site/trunk/www/mime4j: ./ apidocs/
apidocs/org/ apidocs/org/mime4j/ apidocs/org/mime4j/class-use/
apidocs/org/mime4j/decoder/ apidocs/org/mime4j/decoder/class-use/
apidocs/org/mime4j/field/ apidocs/org/mime4j/fie...
Added: james/site/trunk/www/mime4j/xref/org/mime4j/field/ContentTypeField.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mime4j/xref/org/mime4j/field/ContentTypeField.html?rev=437432&view=auto
==============================================================================
--- james/site/trunk/www/mime4j/xref/org/mime4j/field/ContentTypeField.html (added)
+++ james/site/trunk/www/mime4j/xref/org/mime4j/field/ContentTypeField.html Sun Aug 27 11:20:29 2006
@@ -0,0 +1,256 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>ContentTypeField xref</title>
+<link type="text/css" rel="stylesheet" href="../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../../../apidocs/org/mime4j/field/ContentTypeField.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a> <em class="comment">/*</em>
+<a name="2" href="#2">2</a> <em class="comment"> * Copyright 2004 the mime4j project</em>
+<a name="3" href="#3">3</a> <em class="comment"> *</em>
+<a name="4" href="#4">4</a> <em class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</em>
+<a name="5" href="#5">5</a> <em class="comment"> * you may not use this file except in compliance with the License.</em>
+<a name="6" href="#6">6</a> <em class="comment"> * You may obtain a copy of the License at</em>
+<a name="7" href="#7">7</a> <em class="comment"> *</em>
+<a name="8" href="#8">8</a> <em class="comment"> * <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em>
+<a name="9" href="#9">9</a> <em class="comment"> *</em>
+<a name="10" href="#10">10</a> <em class="comment"> * Unless required by applicable law or agreed to in writing, software</em>
+<a name="11" href="#11">11</a> <em class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</em>
+<a name="12" href="#12">12</a> <em class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</em>
+<a name="13" href="#13">13</a> <em class="comment"> * See the License for the specific language governing permissions and</em>
+<a name="14" href="#14">14</a> <em class="comment"> * limitations under the License.</em>
+<a name="15" href="#15">15</a> <em class="comment"> */</em>
+<a name="16" href="#16">16</a> <strong>package</strong> org.mime4j.field;
+<a name="17" href="#17">17</a>
+<a name="18" href="#18">18</a> <strong>import</strong> java.io.StringReader;
+<a name="19" href="#19">19</a> <strong>import</strong> java.util.ArrayList;
+<a name="20" href="#20">20</a> <strong>import</strong> java.util.Collections;
+<a name="21" href="#21">21</a> <strong>import</strong> java.util.HashMap;
+<a name="22" href="#22">22</a> <strong>import</strong> java.util.Map;
+<a name="23" href="#23">23</a>
+<a name="24" href="#24">24</a> <strong>import</strong> org.apache.commons.logging.Log;
+<a name="25" href="#25">25</a> <strong>import</strong> org.apache.commons.logging.LogFactory;
+<a name="26" href="#26">26</a> <strong>import</strong> org.mime4j.field.contenttype.parser.ContentTypeParser;
+<a name="27" href="#27">27</a> <strong>import</strong> org.mime4j.field.contenttype.parser.ParseException;
+<a name="28" href="#28">28</a> <strong>import</strong> org.mime4j.field.contenttype.parser.TokenMgrError;
+<a name="29" href="#29">29</a>
+<a name="30" href="#30">30</a>
+<a name="31" href="#31">31</a> <em>/**<em>*</em></em>
+<a name="32" href="#32">32</a> <em> * Represents a <code>Content-Type</code> field.</em>
+<a name="33" href="#33">33</a> <em> *</em>
+<a name="34" href="#34">34</a> <em> * <p>TODO: Remove dependency on Java 1.4 regexps</p></em>
+<a name="35" href="#35">35</a> <em> *</em>
+<a name="36" href="#36">36</a> <em> * @author Niklas Therning</em>
+<a name="37" href="#37">37</a> <em> * @version $Id: ContentTypeField.java,v 1.6 2005/01/27 14:16:31 ntherning Exp $</em>
+<a name="38" href="#38">38</a> <em> */</em>
+<a name="39" href="#39">39</a> <strong>public</strong> <strong>class</strong> <a href="../../../org/mime4j/field/ContentTypeField.html">ContentTypeField</a> <strong>extends</strong> <a href="../../../org/mime4j/field/Field.html">Field</a> {
+<a name="40" href="#40">40</a> <strong>private</strong> <strong>static</strong> Log log = LogFactory.getLog(ContentTypeField.<strong>class</strong>);
+<a name="41" href="#41">41</a>
+<a name="42" href="#42">42</a> <em>/**<em>*</em></em>
+<a name="43" href="#43">43</a> <em> * The prefix of all <code>multipart</code> MIME types.</em>
+<a name="44" href="#44">44</a> <em> */</em>
+<a name="45" href="#45">45</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String TYPE_MULTIPART_PREFIX = <span class="string">"multipart/"</span>;
+<a name="46" href="#46">46</a> <em>/**<em>*</em></em>
+<a name="47" href="#47">47</a> <em> * The <code>multipart/digest</code> MIME type.</em>
+<a name="48" href="#48">48</a> <em> */</em>
+<a name="49" href="#49">49</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String TYPE_MULTIPART_DIGEST = <span class="string">"multipart/digest"</span>;
+<a name="50" href="#50">50</a> <em>/**<em>*</em></em>
+<a name="51" href="#51">51</a> <em> * The <code>text/plain</code> MIME type.</em>
+<a name="52" href="#52">52</a> <em> */</em>
+<a name="53" href="#53">53</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String TYPE_TEXT_PLAIN = <span class="string">"text/plain"</span>;
+<a name="54" href="#54">54</a> <em>/**<em>*</em></em>
+<a name="55" href="#55">55</a> <em> * The <code>message/rfc822</code> MIME type.</em>
+<a name="56" href="#56">56</a> <em> */</em>
+<a name="57" href="#57">57</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String TYPE_MESSAGE_RFC822 = <span class="string">"message/rfc822"</span>;
+<a name="58" href="#58">58</a> <em>/**<em>*</em></em>
+<a name="59" href="#59">59</a> <em> * The name of the <code>boundary</code> parameter.</em>
+<a name="60" href="#60">60</a> <em> */</em>
+<a name="61" href="#61">61</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String PARAM_BOUNDARY = <span class="string">"boundary"</span>;
+<a name="62" href="#62">62</a> <em>/**<em>*</em></em>
+<a name="63" href="#63">63</a> <em> * The name of the <code>charset</code> parameter.</em>
+<a name="64" href="#64">64</a> <em> */</em>
+<a name="65" href="#65">65</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String PARAM_CHARSET = <span class="string">"charset"</span>;
+<a name="66" href="#66">66</a>
+<a name="67" href="#67">67</a> <strong>private</strong> String mimeType = <span class="string">""</span>;
+<a name="68" href="#68">68</a> <strong>private</strong> HashMap parameters = <strong>null</strong>;
+<a name="69" href="#69">69</a> <strong>private</strong> ParseException parseException;
+<a name="70" href="#70">70</a>
+<a name="71" href="#71">71</a> <strong>protected</strong> <a href="../../../org/mime4j/field/ContentTypeField.html">ContentTypeField</a>() {
+<a name="72" href="#72">72</a> }
+<a name="73" href="#73">73</a>
+<a name="74" href="#74">74</a> <strong>protected</strong> <strong>void</strong> parseBody(String body) {
+<a name="75" href="#75">75</a>
+<a name="76" href="#76">76</a> ContentTypeParser parser = <strong>new</strong> ContentTypeParser(<strong>new</strong> StringReader(body));
+<a name="77" href="#77">77</a> <strong>try</strong> {
+<a name="78" href="#78">78</a> parser.parseAll();
+<a name="79" href="#79">79</a> }
+<a name="80" href="#80">80</a> <strong>catch</strong> (ParseException e) {
+<a name="81" href="#81">81</a> <strong>if</strong> (log.isDebugEnabled()) {
+<a name="82" href="#82">82</a> log.debug(<span class="string">"Parsing value '"</span> + body + <span class="string">"': "</span>+ e.getMessage());
+<a name="83" href="#83">83</a> }
+<a name="84" href="#84">84</a> parseException = e;
+<a name="85" href="#85">85</a> }
+<a name="86" href="#86">86</a> <strong>catch</strong> (TokenMgrError e) {
+<a name="87" href="#87">87</a> <strong>if</strong> (log.isDebugEnabled()) {
+<a name="88" href="#88">88</a> log.debug(<span class="string">"Parsing value '"</span> + body + <span class="string">"': "</span>+ e.getMessage());
+<a name="89" href="#89">89</a> }
+<a name="90" href="#90">90</a> parseException = <strong>new</strong> ParseException(e.getMessage());
+<a name="91" href="#91">91</a> }
+<a name="92" href="#92">92</a>
+<a name="93" href="#93">93</a> <strong>try</strong> {
+<a name="94" href="#94">94</a> <strong>final</strong> String type = parser.getType();
+<a name="95" href="#95">95</a> <strong>final</strong> String subType = parser.getSubType();
+<a name="96" href="#96">96</a>
+<a name="97" href="#97">97</a> <strong>if</strong> (type == <strong>null</strong> || subType == <strong>null</strong>)
+<a name="98" href="#98">98</a> <strong>return</strong>;
+<a name="99" href="#99">99</a> mimeType = (type + <span class="string">"/"</span> + parser.getSubType()).toLowerCase();
+<a name="100" href="#100">100</a>
+<a name="101" href="#101">101</a> ArrayList paramNames = parser.getParamNames();
+<a name="102" href="#102">102</a> ArrayList paramValues = parser.getParamValues();
+<a name="103" href="#103">103</a>
+<a name="104" href="#104">104</a> <strong>if</strong> (paramNames == <strong>null</strong> || paramValues == <strong>null</strong>)
+<a name="105" href="#105">105</a> <strong>return</strong>;
+<a name="106" href="#106">106</a> <strong>for</strong> (<strong>int</strong> i = 0; i < paramNames.size() && i < paramValues.size(); i++) {
+<a name="107" href="#107">107</a> <strong>if</strong> (parameters == <strong>null</strong>)
+<a name="108" href="#108">108</a> parameters = <strong>new</strong> HashMap((<strong>int</strong>)(paramNames.size() * 1.3 + 1));
+<a name="109" href="#109">109</a> String name = ((String)paramNames.get(i)).toLowerCase();
+<a name="110" href="#110">110</a> String value = ((String)paramValues.get(i));
+<a name="111" href="#111">111</a> parameters.put(name, value);
+<a name="112" href="#112">112</a> }
+<a name="113" href="#113">113</a> }
+<a name="114" href="#114">114</a> <strong>catch</strong> (NullPointerException npe) {
+<a name="115" href="#115">115</a> }
+<a name="116" href="#116">116</a> }
+<a name="117" href="#117">117</a>
+<a name="118" href="#118">118</a>
+<a name="119" href="#119">119</a> <em>/**<em>*</em></em>
+<a name="120" href="#120">120</a> <em> * Gets the exception that was raised during parsing of</em>
+<a name="121" href="#121">121</a> <em> * the field value, if any; otherwise, null.</em>
+<a name="122" href="#122">122</a> <em> */</em>
+<a name="123" href="#123">123</a> <strong>public</strong> ParseException getParseException() {
+<a name="124" href="#124">124</a> <strong>return</strong> parseException;
+<a name="125" href="#125">125</a> }
+<a name="126" href="#126">126</a>
+<a name="127" href="#127">127</a> <em>/**<em>*</em></em>
+<a name="128" href="#128">128</a> <em> * Gets the MIME type defined in this Content-Type field.</em>
+<a name="129" href="#129">129</a> <em> * </em>
+<a name="130" href="#130">130</a> <em> * @return the MIME type or an empty string if not set.</em>
+<a name="131" href="#131">131</a> <em> */</em>
+<a name="132" href="#132">132</a> <strong>public</strong> String getMimeType() {
+<a name="133" href="#133">133</a> <strong>return</strong> mimeType;
+<a name="134" href="#134">134</a> }
+<a name="135" href="#135">135</a>
+<a name="136" href="#136">136</a> <em>/**<em>*</em></em>
+<a name="137" href="#137">137</a> <em> * Gets the MIME type defined in the child's </em>
+<a name="138" href="#138">138</a> <em> * Content-Type field or derives a MIME type from the parent </em>
+<a name="139" href="#139">139</a> <em> * if child is <code>null</code> or hasn't got a MIME type value set. </em>
+<a name="140" href="#140">140</a> <em> * If child's MIME type is multipart but no boundary</em>
+<a name="141" href="#141">141</a> <em> * has been set the MIME type of child will be derived from</em>
+<a name="142" href="#142">142</a> <em> * the parent.</em>
+<a name="143" href="#143">143</a> <em> * </em>
+<a name="144" href="#144">144</a> <em> * @param child the child.</em>
+<a name="145" href="#145">145</a> <em> * @param parent the parent.</em>
+<a name="146" href="#146">146</a> <em> * @return the MIME type.</em>
+<a name="147" href="#147">147</a> <em> */</em>
+<a name="148" href="#148">148</a> <strong>public</strong> <strong>static</strong> String getMimeType(<a href="../../../org/mime4j/field/ContentTypeField.html">ContentTypeField</a> child,
+<a name="149" href="#149">149</a> <a href="../../../org/mime4j/field/ContentTypeField.html">ContentTypeField</a> parent) {
+<a name="150" href="#150">150</a>
+<a name="151" href="#151">151</a> <strong>if</strong> (child == <strong>null</strong> || child.getMimeType().length() == 0
+<a name="152" href="#152">152</a> || child.isMultipart() && child.getBoundary() == <strong>null</strong>) {
+<a name="153" href="#153">153</a>
+<a name="154" href="#154">154</a> <strong>if</strong> (parent != <strong>null</strong> && parent.isMimeType(TYPE_MULTIPART_DIGEST)) {
+<a name="155" href="#155">155</a> <strong>return</strong> TYPE_MESSAGE_RFC822;
+<a name="156" href="#156">156</a> } <strong>else</strong> {
+<a name="157" href="#157">157</a> <strong>return</strong> TYPE_TEXT_PLAIN;
+<a name="158" href="#158">158</a> }
+<a name="159" href="#159">159</a> }
+<a name="160" href="#160">160</a>
+<a name="161" href="#161">161</a> <strong>return</strong> child.getMimeType();
+<a name="162" href="#162">162</a> }
+<a name="163" href="#163">163</a>
+<a name="164" href="#164">164</a> <em>/**<em>*</em></em>
+<a name="165" href="#165">165</a> <em> * Gets the value of a parameter. Parameter names are case-insensitive.</em>
+<a name="166" href="#166">166</a> <em> * </em>
+<a name="167" href="#167">167</a> <em> * @param name the name of the parameter to get.</em>
+<a name="168" href="#168">168</a> <em> * @return the parameter value or <code>null</code> if not set.</em>
+<a name="169" href="#169">169</a> <em> */</em>
+<a name="170" href="#170">170</a> <strong>public</strong> String getParameter(String name) {
+<a name="171" href="#171">171</a> <strong>return</strong> parameters != <strong>null</strong>
+<a name="172" href="#172">172</a> ? (String) parameters.get(name.toLowerCase())
+<a name="173" href="#173">173</a> : <strong>null</strong>;
+<a name="174" href="#174">174</a> }
+<a name="175" href="#175">175</a>
+<a name="176" href="#176">176</a> <em>/**<em>*</em></em>
+<a name="177" href="#177">177</a> <em> * Gets all parameters.</em>
+<a name="178" href="#178">178</a> <em> * </em>
+<a name="179" href="#179">179</a> <em> * @return the parameters.</em>
+<a name="180" href="#180">180</a> <em> */</em>
+<a name="181" href="#181">181</a> <strong>public</strong> Map getParameters() {
+<a name="182" href="#182">182</a> <strong>return</strong> parameters != <strong>null</strong>
+<a name="183" href="#183">183</a> ? Collections.unmodifiableMap(parameters)
+<a name="184" href="#184">184</a> : Collections.EMPTY_MAP;
+<a name="185" href="#185">185</a> }
+<a name="186" href="#186">186</a>
+<a name="187" href="#187">187</a> <em>/**<em>*</em></em>
+<a name="188" href="#188">188</a> <em> * Gets the value of the <code>boundary</code> parameter if set.</em>
+<a name="189" href="#189">189</a> <em> * </em>
+<a name="190" href="#190">190</a> <em> * @return the <code>boundary</code> parameter value or <code>null</code> </em>
+<a name="191" href="#191">191</a> <em> * if not set.</em>
+<a name="192" href="#192">192</a> <em> */</em>
+<a name="193" href="#193">193</a> <strong>public</strong> String getBoundary() {
+<a name="194" href="#194">194</a> <strong>return</strong> getParameter(PARAM_BOUNDARY);
+<a name="195" href="#195">195</a> }
+<a name="196" href="#196">196</a>
+<a name="197" href="#197">197</a> <em>/**<em>*</em></em>
+<a name="198" href="#198">198</a> <em> * Gets the value of the <code>charset</code> parameter if set.</em>
+<a name="199" href="#199">199</a> <em> * </em>
+<a name="200" href="#200">200</a> <em> * @return the <code>charset</code> parameter value or <code>null</code> </em>
+<a name="201" href="#201">201</a> <em> * if not set.</em>
+<a name="202" href="#202">202</a> <em> */</em>
+<a name="203" href="#203">203</a> <strong>public</strong> String getCharset() {
+<a name="204" href="#204">204</a> <strong>return</strong> getParameter(PARAM_CHARSET);
+<a name="205" href="#205">205</a> }
+<a name="206" href="#206">206</a>
+<a name="207" href="#207">207</a> <em>/**<em>*</em></em>
+<a name="208" href="#208">208</a> <em> * Gets the value of the <code>charset</code> parameter if set for the</em>
+<a name="209" href="#209">209</a> <em> * given field. Returns the default <code>us-ascii</code> if not set or if</em>
+<a name="210" href="#210">210</a> <em> * <code>f</code> is <code>null</code>.</em>
+<a name="211" href="#211">211</a> <em> * </em>
+<a name="212" href="#212">212</a> <em> * @return the <code>charset</code> parameter value.</em>
+<a name="213" href="#213">213</a> <em> */</em>
+<a name="214" href="#214">214</a> <strong>public</strong> <strong>static</strong> String getCharset(<a href="../../../org/mime4j/field/ContentTypeField.html">ContentTypeField</a> f) {
+<a name="215" href="#215">215</a> <strong>if</strong> (f != <strong>null</strong>) {
+<a name="216" href="#216">216</a> <strong>if</strong> (f.getCharset() != <strong>null</strong> && f.getCharset().length() > 0) {
+<a name="217" href="#217">217</a> <strong>return</strong> f.getCharset();
+<a name="218" href="#218">218</a> }
+<a name="219" href="#219">219</a> }
+<a name="220" href="#220">220</a> <strong>return</strong> <span class="string">"us-ascii"</span>;
+<a name="221" href="#221">221</a> }
+<a name="222" href="#222">222</a>
+<a name="223" href="#223">223</a> <em>/**<em>*</em></em>
+<a name="224" href="#224">224</a> <em> * Determines if the MIME type of this field matches the given one. </em>
+<a name="225" href="#225">225</a> <em> * </em>
+<a name="226" href="#226">226</a> <em> * @param mimeType the MIME type to match against.</em>
+<a name="227" href="#227">227</a> <em> * @return <code>true</code> if the MIME type of this field matches, </em>
+<a name="228" href="#228">228</a> <em> * <code>false</code> otherwise. </em>
+<a name="229" href="#229">229</a> <em> */</em>
+<a name="230" href="#230">230</a> <strong>public</strong> <strong>boolean</strong> isMimeType(String mimeType) {
+<a name="231" href="#231">231</a> <strong>return</strong> <strong>this</strong>.mimeType.equalsIgnoreCase(mimeType);
+<a name="232" href="#232">232</a> }
+<a name="233" href="#233">233</a>
+<a name="234" href="#234">234</a> <em>/**<em>*</em></em>
+<a name="235" href="#235">235</a> <em> * Determines if the MIME type of this field is <code>multipart/*</code>.</em>
+<a name="236" href="#236">236</a> <em> * </em>
+<a name="237" href="#237">237</a> <em> * @return <code>true</code> if this field is has a <code>multipart/*</code></em>
+<a name="238" href="#238">238</a> <em> * MIME type, <code>false</code> otherwise. </em>
+<a name="239" href="#239">239</a> <em> */</em>
+<a name="240" href="#240">240</a> <strong>public</strong> <strong>boolean</strong> isMultipart() {
+<a name="241" href="#241">241</a> <strong>return</strong> mimeType.startsWith(TYPE_MULTIPART_PREFIX);
+<a name="242" href="#242">242</a> }
+<a name="243" href="#243">243</a> }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+
Propchange: james/site/trunk/www/mime4j/xref/org/mime4j/field/ContentTypeField.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: james/site/trunk/www/mime4j/xref/org/mime4j/field/DateTimeField.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mime4j/xref/org/mime4j/field/DateTimeField.html?rev=437432&view=auto
==============================================================================
--- james/site/trunk/www/mime4j/xref/org/mime4j/field/DateTimeField.html (added)
+++ james/site/trunk/www/mime4j/xref/org/mime4j/field/DateTimeField.html Sun Aug 27 11:20:29 2006
@@ -0,0 +1,63 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>DateTimeField xref</title>
+<link type="text/css" rel="stylesheet" href="../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../../../apidocs/org/mime4j/field/DateTimeField.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a> <em class="comment">/*</em>
+<a name="2" href="#2">2</a> <em class="comment"> * Copyright 2004 the mime4j project</em>
+<a name="3" href="#3">3</a> <em class="comment"> *</em>
+<a name="4" href="#4">4</a> <em class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</em>
+<a name="5" href="#5">5</a> <em class="comment"> * you may not use this file except in compliance with the License.</em>
+<a name="6" href="#6">6</a> <em class="comment"> * You may obtain a copy of the License at</em>
+<a name="7" href="#7">7</a> <em class="comment"> *</em>
+<a name="8" href="#8">8</a> <em class="comment"> * <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em>
+<a name="9" href="#9">9</a> <em class="comment"> *</em>
+<a name="10" href="#10">10</a> <em class="comment"> * Unless required by applicable law or agreed to in writing, software</em>
+<a name="11" href="#11">11</a> <em class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</em>
+<a name="12" href="#12">12</a> <em class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</em>
+<a name="13" href="#13">13</a> <em class="comment"> * See the License for the specific language governing permissions and</em>
+<a name="14" href="#14">14</a> <em class="comment"> * limitations under the License.</em>
+<a name="15" href="#15">15</a> <em class="comment"> */</em>
+<a name="16" href="#16">16</a> <strong>package</strong> org.mime4j.field;
+<a name="17" href="#17">17</a>
+<a name="18" href="#18">18</a> <strong>import</strong> org.apache.commons.logging.Log;
+<a name="19" href="#19">19</a> <strong>import</strong> org.apache.commons.logging.LogFactory;
+<a name="20" href="#20">20</a> <strong>import</strong> org.mime4j.field.datetime.DateTime;
+<a name="21" href="#21">21</a> <strong>import</strong> org.mime4j.field.datetime.parser.ParseException;
+<a name="22" href="#22">22</a>
+<a name="23" href="#23">23</a> <strong>import</strong> java.util.Date;
+<a name="24" href="#24">24</a>
+<a name="25" href="#25">25</a> <strong>public</strong> <strong>class</strong> <a href="../../../org/mime4j/field/DateTimeField.html">DateTimeField</a> <strong>extends</strong> <a href="../../../org/mime4j/field/Field.html">Field</a> {
+<a name="26" href="#26">26</a> <strong>private</strong> <strong>static</strong> Log log = LogFactory.getLog(DateTimeField.<strong>class</strong>);
+<a name="27" href="#27">27</a>
+<a name="28" href="#28">28</a> <strong>private</strong> Date date;
+<a name="29" href="#29">29</a> <strong>private</strong> ParseException parseException;
+<a name="30" href="#30">30</a>
+<a name="31" href="#31">31</a> <strong>public</strong> Date getDate() {
+<a name="32" href="#32">32</a> <strong>return</strong> date;
+<a name="33" href="#33">33</a> }
+<a name="34" href="#34">34</a>
+<a name="35" href="#35">35</a> <strong>public</strong> ParseException getParseException() {
+<a name="36" href="#36">36</a> <strong>return</strong> parseException;
+<a name="37" href="#37">37</a> }
+<a name="38" href="#38">38</a>
+<a name="39" href="#39">39</a> <strong>protected</strong> <strong>void</strong> parseBody(String body) {
+<a name="40" href="#40">40</a> <strong>try</strong> {
+<a name="41" href="#41">41</a> date = DateTime.parse(body).getDate();
+<a name="42" href="#42">42</a> }
+<a name="43" href="#43">43</a> <strong>catch</strong> (ParseException e) {
+<a name="44" href="#44">44</a> <strong>if</strong> (log.isDebugEnabled()) {
+<a name="45" href="#45">45</a> log.debug(<span class="string">"Parsing value '"</span> + body + <span class="string">"': "</span>+ e.getMessage());
+<a name="46" href="#46">46</a> }
+<a name="47" href="#47">47</a> parseException = e;
+<a name="48" href="#48">48</a> }
+<a name="49" href="#49">49</a> }
+<a name="50" href="#50">50</a> }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+
Propchange: james/site/trunk/www/mime4j/xref/org/mime4j/field/DateTimeField.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: james/site/trunk/www/mime4j/xref/org/mime4j/field/Field.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mime4j/xref/org/mime4j/field/Field.html?rev=437432&view=auto
==============================================================================
--- james/site/trunk/www/mime4j/xref/org/mime4j/field/Field.html (added)
+++ james/site/trunk/www/mime4j/xref/org/mime4j/field/Field.html Sun Aug 27 11:20:29 2006
@@ -0,0 +1,226 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>Field xref</title>
+<link type="text/css" rel="stylesheet" href="../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../../../apidocs/org/mime4j/field/Field.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a> <em class="comment">/*</em>
+<a name="2" href="#2">2</a> <em class="comment"> * Copyright 2004 the mime4j project</em>
+<a name="3" href="#3">3</a> <em class="comment"> *</em>
+<a name="4" href="#4">4</a> <em class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</em>
+<a name="5" href="#5">5</a> <em class="comment"> * you may not use this file except in compliance with the License.</em>
+<a name="6" href="#6">6</a> <em class="comment"> * You may obtain a copy of the License at</em>
+<a name="7" href="#7">7</a> <em class="comment"> *</em>
+<a name="8" href="#8">8</a> <em class="comment"> * <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em>
+<a name="9" href="#9">9</a> <em class="comment"> *</em>
+<a name="10" href="#10">10</a> <em class="comment"> * Unless required by applicable law or agreed to in writing, software</em>
+<a name="11" href="#11">11</a> <em class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</em>
+<a name="12" href="#12">12</a> <em class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</em>
+<a name="13" href="#13">13</a> <em class="comment"> * See the License for the specific language governing permissions and</em>
+<a name="14" href="#14">14</a> <em class="comment"> * limitations under the License.</em>
+<a name="15" href="#15">15</a> <em class="comment"> */</em>
+<a name="16" href="#16">16</a> <strong>package</strong> org.mime4j.field;
+<a name="17" href="#17">17</a>
+<a name="18" href="#18">18</a> <strong>import</strong> java.util.regex.Matcher;
+<a name="19" href="#19">19</a> <strong>import</strong> java.util.regex.Pattern;
+<a name="20" href="#20">20</a>
+<a name="21" href="#21">21</a> <strong>import</strong> org.apache.commons.logging.Log;
+<a name="22" href="#22">22</a> <strong>import</strong> org.apache.commons.logging.LogFactory;
+<a name="23" href="#23">23</a>
+<a name="24" href="#24">24</a>
+<a name="25" href="#25">25</a> <em>/**<em>*</em></em>
+<a name="26" href="#26">26</a> <em> * The base class of all field classes.</em>
+<a name="27" href="#27">27</a> <em> *</em>
+<a name="28" href="#28">28</a> <em> * @author Niklas Therning</em>
+<a name="29" href="#29">29</a> <em> * @version $Id: Field.java,v 1.6 2004/10/25 07:26:46 ntherning Exp $</em>
+<a name="30" href="#30">30</a> <em> */</em>
+<a name="31" href="#31">31</a> <strong>public</strong> <strong>abstract</strong> <strong>class</strong> <a href="../../../org/mime4j/field/Field.html">Field</a> {
+<a name="32" href="#32">32</a> <strong>private</strong> <strong>static</strong> Log log = LogFactory.getLog(Field.<strong>class</strong>);
+<a name="33" href="#33">33</a>
+<a name="34" href="#34">34</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String SENDER = <span class="string">"Sender"</span>;
+<a name="35" href="#35">35</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String FROM = <span class="string">"From"</span>;
+<a name="36" href="#36">36</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String TO = <span class="string">"To"</span>;
+<a name="37" href="#37">37</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String CC = <span class="string">"Cc"</span>;
+<a name="38" href="#38">38</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String BCC = <span class="string">"Bcc"</span>;
+<a name="39" href="#39">39</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String REPLY_TO = <span class="string">"Reply-To"</span>;
+<a name="40" href="#40">40</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String RESENT_SENDER = <span class="string">"Resent-Sender"</span>;
+<a name="41" href="#41">41</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String RESENT_FROM = <span class="string">"Resent-From"</span>;
+<a name="42" href="#42">42</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String RESENT_TO = <span class="string">"Resent-To"</span>;
+<a name="43" href="#43">43</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String RESENT_CC = <span class="string">"Resent-Cc"</span>;
+<a name="44" href="#44">44</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String RESENT_BCC = <span class="string">"Resent-Bcc"</span>;
+<a name="45" href="#45">45</a>
+<a name="46" href="#46">46</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String DATE = <span class="string">"Date"</span>;
+<a name="47" href="#47">47</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String RESENT_DATE = <span class="string">"Resent-Date"</span>;
+<a name="48" href="#48">48</a>
+<a name="49" href="#49">49</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String SUBJECT = <span class="string">"Subject"</span>;
+<a name="50" href="#50">50</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String CONTENT_TYPE = <span class="string">"Content-Type"</span>;
+<a name="51" href="#51">51</a> <strong>public</strong> <strong>static</strong> <strong>final</strong> String CONTENT_TRANSFER_ENCODING =
+<a name="52" href="#52">52</a> <span class="string">"Content-Transfer-Encoding"</span>;
+<a name="53" href="#53">53</a>
+<a name="54" href="#54">54</a> <strong>private</strong> <strong>static</strong> <strong>final</strong> String FIELD_NAME_PATTERN =
+<a name="55" href="#55">55</a> <span class="string">"^([//x21-//x39//x3b-//x7e]+)[ \t]*:"</span>;
+<a name="56" href="#56">56</a> <strong>private</strong> <strong>static</strong> Pattern fieldNamePattern =
+<a name="57" href="#57">57</a> Pattern.compile(FIELD_NAME_PATTERN);
+<a name="58" href="#58">58</a>
+<a name="59" href="#59">59</a> <strong>private</strong> String name;
+<a name="60" href="#60">60</a> <strong>private</strong> String body;
+<a name="61" href="#61">61</a> <strong>private</strong> String raw;
+<a name="62" href="#62">62</a>
+<a name="63" href="#63">63</a> <strong>protected</strong> <a href="../../../org/mime4j/field/Field.html">Field</a>() {
+<a name="64" href="#64">64</a> }
+<a name="65" href="#65">65</a>
+<a name="66" href="#66">66</a> <em>/**<em>*</em></em>
+<a name="67" href="#67">67</a> <em> * Parsers the given string and returns an instance of the </em>
+<a name="68" href="#68">68</a> <em> * <code>Field</code> class. The type of the class returned depends on</em>
+<a name="69" href="#69">69</a> <em> * the field name:</em>
+<a name="70" href="#70">70</a> <em> * <table></em>
+<a name="71" href="#71">71</a> <em> * <tr></em>
+<a name="72" href="#72">72</a> <em> * <td><em>Field name</em></td><td><em>Class returned</em></td></em>
+<a name="73" href="#73">73</a> <em> * <td>Content-Type</td><td>org.mime4j.field.ContentTypeField</td></em>
+<a name="74" href="#74">74</a> <em> * <td>other</td><td>org.mime4j.field.UnstructuredField</td></em>
+<a name="75" href="#75">75</a> <em> * </tr></em>
+<a name="76" href="#76">76</a> <em> * </table></em>
+<a name="77" href="#77">77</a> <em> * </em>
+<a name="78" href="#78">78</a> <em> * @param s the string to parse.</em>
+<a name="79" href="#79">79</a> <em> * @return a <code>Field</code> instance.</em>
+<a name="80" href="#80">80</a> <em> * @throws IllegalArgumentException on parse errors.</em>
+<a name="81" href="#81">81</a> <em> */</em>
+<a name="82" href="#82">82</a> <strong>public</strong> <strong>static</strong> <a href="../../../org/mime4j/field/Field.html">Field</a> parse(String s) {
+<a name="83" href="#83">83</a> String raw = s;
+<a name="84" href="#84">84</a>
+<a name="85" href="#85">85</a> <em class="comment">/*</em>
+<a name="86" href="#86">86</a> <em class="comment"> * Unfold the field.</em>
+<a name="87" href="#87">87</a> <em class="comment"> */</em>
+<a name="88" href="#88">88</a> s = s.replaceAll(<span class="string">"\r|\n"</span>, <span class="string">""</span>);
+<a name="89" href="#89">89</a>
+<a name="90" href="#90">90</a> <em class="comment">/*</em>
+<a name="91" href="#91">91</a> <em class="comment"> * Split into name and value.</em>
+<a name="92" href="#92">92</a> <em class="comment"> */</em>
+<a name="93" href="#93">93</a> Matcher fieldMatcher = fieldNamePattern.matcher(s);
+<a name="94" href="#94">94</a> <strong>if</strong> (!fieldMatcher.find()) {
+<a name="95" href="#95">95</a> <strong>throw</strong> <strong>new</strong> IllegalArgumentException(<span class="string">"Invalid field in string"</span>);
+<a name="96" href="#96">96</a> }
+<a name="97" href="#97">97</a> String name = fieldMatcher.group(1);
+<a name="98" href="#98">98</a>
+<a name="99" href="#99">99</a> String body = s.substring(fieldMatcher.end());
+<a name="100" href="#100">100</a> <strong>if</strong> (body.length() > 0 && body.charAt(0) == ' ') {
+<a name="101" href="#101">101</a> body = body.substring(1);
+<a name="102" href="#102">102</a> }
+<a name="103" href="#103">103</a>
+<a name="104" href="#104">104</a> <a href="../../../org/mime4j/field/Field.html">Field</a> f = <strong>null</strong>;
+<a name="105" href="#105">105</a>
+<a name="106" href="#106">106</a> <em class="comment">// TODO jcheng 2004-09-27: Clean this up</em>
+<a name="107" href="#107">107</a>
+<a name="108" href="#108">108</a> <strong>if</strong> (name.equalsIgnoreCase(CONTENT_TRANSFER_ENCODING)) {
+<a name="109" href="#109">109</a> f = <strong>new</strong> <a href="../../../org/mime4j/field/ContentTransferEncodingField.html">ContentTransferEncodingField</a>();
+<a name="110" href="#110">110</a> } <strong>else</strong> <strong>if</strong> (name.equalsIgnoreCase(CONTENT_TYPE)) {
+<a name="111" href="#111">111</a> f = <strong>new</strong> <a href="../../../org/mime4j/field/ContentTypeField.html">ContentTypeField</a>();
+<a name="112" href="#112">112</a> } <strong>else</strong> <strong>if</strong> (name.equalsIgnoreCase(DATE) || name.equalsIgnoreCase(RESENT_DATE)) {
+<a name="113" href="#113">113</a> f = <strong>new</strong> <a href="../../../org/mime4j/field/DateTimeField.html">DateTimeField</a>();
+<a name="114" href="#114">114</a> } <strong>else</strong> <strong>if</strong> (name.equalsIgnoreCase(FROM) || name.equalsIgnoreCase(RESENT_FROM)) {
+<a name="115" href="#115">115</a> f = <strong>new</strong> <a href="../../../org/mime4j/field/MailboxListField.html">MailboxListField</a>();
+<a name="116" href="#116">116</a> } <strong>else</strong> <strong>if</strong> (name.equalsIgnoreCase(SENDER) || name.equalsIgnoreCase(RESENT_SENDER)) {
+<a name="117" href="#117">117</a> f = <strong>new</strong> <a href="../../../org/mime4j/field/MailboxField.html">MailboxField</a>();
+<a name="118" href="#118">118</a> } <strong>else</strong> <strong>if</strong> (name.equalsIgnoreCase(TO) || name.equalsIgnoreCase(CC) || name.equalsIgnoreCase(BCC)
+<a name="119" href="#119">119</a> || name.equalsIgnoreCase(RESENT_TO) || name.equalsIgnoreCase(RESENT_CC)
+<a name="120" href="#120">120</a> || name.equalsIgnoreCase(RESENT_BCC) || name.equalsIgnoreCase(REPLY_TO)) {
+<a name="121" href="#121">121</a> f = <strong>new</strong> <a href="../../../org/mime4j/field/AddressListField.html">AddressListField</a>();
+<a name="122" href="#122">122</a> } <strong>else</strong> {
+<a name="123" href="#123">123</a> f = <strong>new</strong> <a href="../../../org/mime4j/field/UnstructuredField.html">UnstructuredField</a>();
+<a name="124" href="#124">124</a> }
+<a name="125" href="#125">125</a>
+<a name="126" href="#126">126</a> f.name = name;
+<a name="127" href="#127">127</a> f.raw = raw;
+<a name="128" href="#128">128</a> f.body = body;
+<a name="129" href="#129">129</a> f.parseBody(body);
+<a name="130" href="#130">130</a>
+<a name="131" href="#131">131</a> <strong>return</strong> f;
+<a name="132" href="#132">132</a> }
+<a name="133" href="#133">133</a>
+<a name="134" href="#134">134</a> <em>/**<em>*</em></em>
+<a name="135" href="#135">135</a> <em> * Parses the field body.</em>
+<a name="136" href="#136">136</a> <em> * </em>
+<a name="137" href="#137">137</a> <em> * @param body the field unfolded body.</em>
+<a name="138" href="#138">138</a> <em> */</em>
+<a name="139" href="#139">139</a> <strong>protected</strong> <strong>abstract</strong> <strong>void</strong> parseBody(String body);
+<a name="140" href="#140">140</a>
+<a name="141" href="#141">141</a> <em>/**<em>*</em></em>
+<a name="142" href="#142">142</a> <em> * Gets the name of the field (<code>Subject</code>, </em>
+<a name="143" href="#143">143</a> <em> * <code>From</code>, etc).</em>
+<a name="144" href="#144">144</a> <em> * </em>
+<a name="145" href="#145">145</a> <em> * @return the field name.</em>
+<a name="146" href="#146">146</a> <em> */</em>
+<a name="147" href="#147">147</a> <strong>public</strong> String getName() {
+<a name="148" href="#148">148</a> <strong>return</strong> name;
+<a name="149" href="#149">149</a> }
+<a name="150" href="#150">150</a>
+<a name="151" href="#151">151</a> <em>/**<em>*</em></em>
+<a name="152" href="#152">152</a> <em> * Gets the original raw field string.</em>
+<a name="153" href="#153">153</a> <em> * </em>
+<a name="154" href="#154">154</a> <em> * @return the original raw field string.</em>
+<a name="155" href="#155">155</a> <em> */</em>
+<a name="156" href="#156">156</a> <strong>public</strong> String getRaw() {
+<a name="157" href="#157">157</a> <strong>return</strong> raw;
+<a name="158" href="#158">158</a> }
+<a name="159" href="#159">159</a>
+<a name="160" href="#160">160</a> <em>/**<em>*</em></em>
+<a name="161" href="#161">161</a> <em> * Gets the unfolded, unparsed and possibly encoded (see RFC 2047) field </em>
+<a name="162" href="#162">162</a> <em> * body string.</em>
+<a name="163" href="#163">163</a> <em> * </em>
+<a name="164" href="#164">164</a> <em> * @return the unfolded unparsed field body string.</em>
+<a name="165" href="#165">165</a> <em> */</em>
+<a name="166" href="#166">166</a> <strong>public</strong> String getBody() {
+<a name="167" href="#167">167</a> <strong>return</strong> body;
+<a name="168" href="#168">168</a> }
+<a name="169" href="#169">169</a>
+<a name="170" href="#170">170</a> <em>/**<em>*</em></em>
+<a name="171" href="#171">171</a> <em> * Determines if this is a <code>Content-Type</code> field.</em>
+<a name="172" href="#172">172</a> <em> * </em>
+<a name="173" href="#173">173</a> <em> * @return <code>true</code> if this is a <code>Content-Type</code> field,</em>
+<a name="174" href="#174">174</a> <em> * <code>false</code> otherwise.</em>
+<a name="175" href="#175">175</a> <em> */</em>
+<a name="176" href="#176">176</a> <strong>public</strong> <strong>boolean</strong> isContentType() {
+<a name="177" href="#177">177</a> <strong>return</strong> CONTENT_TYPE.equalsIgnoreCase(name);
+<a name="178" href="#178">178</a> }
+<a name="179" href="#179">179</a>
+<a name="180" href="#180">180</a> <em>/**<em>*</em></em>
+<a name="181" href="#181">181</a> <em> * Determines if this is a <code>Subject</code> field.</em>
+<a name="182" href="#182">182</a> <em> * </em>
+<a name="183" href="#183">183</a> <em> * @return <code>true</code> if this is a <code>Subject</code> field,</em>
+<a name="184" href="#184">184</a> <em> * <code>false</code> otherwise.</em>
+<a name="185" href="#185">185</a> <em> */</em>
+<a name="186" href="#186">186</a> <strong>public</strong> <strong>boolean</strong> isSubject() {
+<a name="187" href="#187">187</a> <strong>return</strong> SUBJECT.equalsIgnoreCase(name);
+<a name="188" href="#188">188</a> }
+<a name="189" href="#189">189</a>
+<a name="190" href="#190">190</a> <em>/**<em>*</em></em>
+<a name="191" href="#191">191</a> <em> * Determines if this is a <code>From</code> field.</em>
+<a name="192" href="#192">192</a> <em> * </em>
+<a name="193" href="#193">193</a> <em> * @return <code>true</code> if this is a <code>From</code> field,</em>
+<a name="194" href="#194">194</a> <em> * <code>false</code> otherwise.</em>
+<a name="195" href="#195">195</a> <em> */</em>
+<a name="196" href="#196">196</a> <strong>public</strong> <strong>boolean</strong> isFrom() {
+<a name="197" href="#197">197</a> <strong>return</strong> FROM.equalsIgnoreCase(name);
+<a name="198" href="#198">198</a> }
+<a name="199" href="#199">199</a>
+<a name="200" href="#200">200</a> <em>/**<em>*</em></em>
+<a name="201" href="#201">201</a> <em> * Determines if this is a <code>To</code> field.</em>
+<a name="202" href="#202">202</a> <em> * </em>
+<a name="203" href="#203">203</a> <em> * @return <code>true</code> if this is a <code>To</code> field,</em>
+<a name="204" href="#204">204</a> <em> * <code>false</code> otherwise.</em>
+<a name="205" href="#205">205</a> <em> */</em>
+<a name="206" href="#206">206</a> <strong>public</strong> <strong>boolean</strong> isTo() {
+<a name="207" href="#207">207</a> <strong>return</strong> TO.equalsIgnoreCase(name);
+<a name="208" href="#208">208</a> }
+<a name="209" href="#209">209</a>
+<a name="210" href="#210">210</a> <strong>public</strong> String toString() {
+<a name="211" href="#211">211</a> <strong>return</strong> raw;
+<a name="212" href="#212">212</a> }
+<a name="213" href="#213">213</a> }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+
Propchange: james/site/trunk/www/mime4j/xref/org/mime4j/field/Field.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: james/site/trunk/www/mime4j/xref/org/mime4j/field/MailboxField.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mime4j/xref/org/mime4j/field/MailboxField.html?rev=437432&view=auto
==============================================================================
--- james/site/trunk/www/mime4j/xref/org/mime4j/field/MailboxField.html (added)
+++ james/site/trunk/www/mime4j/xref/org/mime4j/field/MailboxField.html Sun Aug 27 11:20:29 2006
@@ -0,0 +1,72 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>MailboxField xref</title>
+<link type="text/css" rel="stylesheet" href="../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../../../apidocs/org/mime4j/field/MailboxField.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a> <em class="comment">/*</em>
+<a name="2" href="#2">2</a> <em class="comment"> * Copyright 2004 the mime4j project</em>
+<a name="3" href="#3">3</a> <em class="comment"> *</em>
+<a name="4" href="#4">4</a> <em class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</em>
+<a name="5" href="#5">5</a> <em class="comment"> * you may not use this file except in compliance with the License.</em>
+<a name="6" href="#6">6</a> <em class="comment"> * You may obtain a copy of the License at</em>
+<a name="7" href="#7">7</a> <em class="comment"> *</em>
+<a name="8" href="#8">8</a> <em class="comment"> * <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em>
+<a name="9" href="#9">9</a> <em class="comment"> *</em>
+<a name="10" href="#10">10</a> <em class="comment"> * Unless required by applicable law or agreed to in writing, software</em>
+<a name="11" href="#11">11</a> <em class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</em>
+<a name="12" href="#12">12</a> <em class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</em>
+<a name="13" href="#13">13</a> <em class="comment"> * See the License for the specific language governing permissions and</em>
+<a name="14" href="#14">14</a> <em class="comment"> * limitations under the License.</em>
+<a name="15" href="#15">15</a> <em class="comment"> */</em>
+<a name="16" href="#16">16</a> <strong>package</strong> org.mime4j.field;
+<a name="17" href="#17">17</a>
+<a name="18" href="#18">18</a> <strong>import</strong> org.apache.commons.logging.Log;
+<a name="19" href="#19">19</a> <strong>import</strong> org.apache.commons.logging.LogFactory;
+<a name="20" href="#20">20</a> <strong>import</strong> org.mime4j.field.address.AddressList;
+<a name="21" href="#21">21</a> <strong>import</strong> org.mime4j.field.address.Mailbox;
+<a name="22" href="#22">22</a> <strong>import</strong> org.mime4j.field.address.MailboxList;
+<a name="23" href="#23">23</a> <strong>import</strong> org.mime4j.field.address.parser.ParseException;
+<a name="24" href="#24">24</a>
+<a name="25" href="#25">25</a> <strong>public</strong> <strong>class</strong> <a href="../../../org/mime4j/field/MailboxField.html">MailboxField</a> <strong>extends</strong> <a href="../../../org/mime4j/field/Field.html">Field</a> {
+<a name="26" href="#26">26</a> <strong>private</strong> <strong>static</strong> Log log = LogFactory.getLog(MailboxField.<strong>class</strong>);
+<a name="27" href="#27">27</a>
+<a name="28" href="#28">28</a> <strong>private</strong> <a href="../../../org/mime4j/field/address/Mailbox.html">Mailbox</a> mailbox;
+<a name="29" href="#29">29</a> <strong>private</strong> ParseException parseException;
+<a name="30" href="#30">30</a>
+<a name="31" href="#31">31</a> <strong>public</strong> <a href="../../../org/mime4j/field/address/Mailbox.html">Mailbox</a> getMailbox() {
+<a name="32" href="#32">32</a> <strong>return</strong> mailbox;
+<a name="33" href="#33">33</a> }
+<a name="34" href="#34">34</a>
+<a name="35" href="#35">35</a> <strong>public</strong> ParseException getParseException() {
+<a name="36" href="#36">36</a> <strong>return</strong> parseException;
+<a name="37" href="#37">37</a> }
+<a name="38" href="#38">38</a>
+<a name="39" href="#39">39</a> <em>/**<em>*</em></em>
+<a name="40" href="#40">40</a> <em> * Attempts to parse the body into an e-mail address.</em>
+<a name="41" href="#41">41</a> <em> * If address is invalid, it will be set to null.</em>
+<a name="42" href="#42">42</a> <em> */</em>
+<a name="43" href="#43">43</a> <strong>protected</strong> <strong>void</strong> parseBody(String body) {
+<a name="44" href="#44">44</a>
+<a name="45" href="#45">45</a> <strong>try</strong> {
+<a name="46" href="#46">46</a> <a href="../../../org/mime4j/field/address/MailboxList.html">MailboxList</a> mailboxList = AddressList.parse(body).flatten();
+<a name="47" href="#47">47</a> <strong>if</strong> (mailboxList.size() > 0) {
+<a name="48" href="#48">48</a> mailbox = mailboxList.get(0);
+<a name="49" href="#49">49</a> }
+<a name="50" href="#50">50</a> }
+<a name="51" href="#51">51</a> <strong>catch</strong> (ParseException e) {
+<a name="52" href="#52">52</a> <strong>if</strong> (log.isDebugEnabled()) {
+<a name="53" href="#53">53</a> log.debug(<span class="string">"Parsing value '"</span> + body + <span class="string">"': "</span>+ e.getMessage());
+<a name="54" href="#54">54</a> }
+<a name="55" href="#55">55</a> parseException = e;
+<a name="56" href="#56">56</a> }
+<a name="57" href="#57">57</a> }
+<a name="58" href="#58">58</a>
+<a name="59" href="#59">59</a> }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+
Propchange: james/site/trunk/www/mime4j/xref/org/mime4j/field/MailboxField.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: james/site/trunk/www/mime4j/xref/org/mime4j/field/MailboxListField.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mime4j/xref/org/mime4j/field/MailboxListField.html?rev=437432&view=auto
==============================================================================
--- james/site/trunk/www/mime4j/xref/org/mime4j/field/MailboxListField.html (added)
+++ james/site/trunk/www/mime4j/xref/org/mime4j/field/MailboxListField.html Sun Aug 27 11:20:29 2006
@@ -0,0 +1,63 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>MailboxListField xref</title>
+<link type="text/css" rel="stylesheet" href="../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../../../apidocs/org/mime4j/field/MailboxListField.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a> <em class="comment">/*</em>
+<a name="2" href="#2">2</a> <em class="comment"> * Copyright 2004 the mime4j project</em>
+<a name="3" href="#3">3</a> <em class="comment"> *</em>
+<a name="4" href="#4">4</a> <em class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</em>
+<a name="5" href="#5">5</a> <em class="comment"> * you may not use this file except in compliance with the License.</em>
+<a name="6" href="#6">6</a> <em class="comment"> * You may obtain a copy of the License at</em>
+<a name="7" href="#7">7</a> <em class="comment"> *</em>
+<a name="8" href="#8">8</a> <em class="comment"> * <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em>
+<a name="9" href="#9">9</a> <em class="comment"> *</em>
+<a name="10" href="#10">10</a> <em class="comment"> * Unless required by applicable law or agreed to in writing, software</em>
+<a name="11" href="#11">11</a> <em class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</em>
+<a name="12" href="#12">12</a> <em class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</em>
+<a name="13" href="#13">13</a> <em class="comment"> * See the License for the specific language governing permissions and</em>
+<a name="14" href="#14">14</a> <em class="comment"> * limitations under the License.</em>
+<a name="15" href="#15">15</a> <em class="comment"> */</em>
+<a name="16" href="#16">16</a> <strong>package</strong> org.mime4j.field;
+<a name="17" href="#17">17</a>
+<a name="18" href="#18">18</a> <strong>import</strong> org.apache.commons.logging.Log;
+<a name="19" href="#19">19</a> <strong>import</strong> org.apache.commons.logging.LogFactory;
+<a name="20" href="#20">20</a> <strong>import</strong> org.mime4j.field.address.AddressList;
+<a name="21" href="#21">21</a> <strong>import</strong> org.mime4j.field.address.MailboxList;
+<a name="22" href="#22">22</a> <strong>import</strong> org.mime4j.field.address.parser.ParseException;
+<a name="23" href="#23">23</a>
+<a name="24" href="#24">24</a> <strong>public</strong> <strong>class</strong> <a href="../../../org/mime4j/field/MailboxListField.html">MailboxListField</a> <strong>extends</strong> <a href="../../../org/mime4j/field/Field.html">Field</a> {
+<a name="25" href="#25">25</a> <strong>private</strong> <strong>static</strong> Log log = LogFactory.getLog(MailboxListField.<strong>class</strong>);
+<a name="26" href="#26">26</a>
+<a name="27" href="#27">27</a> <strong>private</strong> <a href="../../../org/mime4j/field/address/MailboxList.html">MailboxList</a> mailboxList;
+<a name="28" href="#28">28</a> <strong>private</strong> ParseException parseException;
+<a name="29" href="#29">29</a>
+<a name="30" href="#30">30</a> <strong>public</strong> <a href="../../../org/mime4j/field/address/MailboxList.html">MailboxList</a> getMailboxList() {
+<a name="31" href="#31">31</a> <strong>return</strong> mailboxList;
+<a name="32" href="#32">32</a> }
+<a name="33" href="#33">33</a>
+<a name="34" href="#34">34</a> <strong>public</strong> ParseException getParseException() {
+<a name="35" href="#35">35</a> <strong>return</strong> parseException;
+<a name="36" href="#36">36</a> }
+<a name="37" href="#37">37</a>
+<a name="38" href="#38">38</a> <strong>protected</strong> <strong>void</strong> parseBody(String body) {
+<a name="39" href="#39">39</a> <strong>try</strong> {
+<a name="40" href="#40">40</a> mailboxList = AddressList.parse(body).flatten();
+<a name="41" href="#41">41</a> }
+<a name="42" href="#42">42</a> <strong>catch</strong> (ParseException e) {
+<a name="43" href="#43">43</a> <strong>if</strong> (log.isDebugEnabled()) {
+<a name="44" href="#44">44</a> log.debug(<span class="string">"Parsing value '"</span> + body + <span class="string">"': "</span>+ e.getMessage());
+<a name="45" href="#45">45</a> }
+<a name="46" href="#46">46</a> parseException = e;
+<a name="47" href="#47">47</a> }
+<a name="48" href="#48">48</a>
+<a name="49" href="#49">49</a> }
+<a name="50" href="#50">50</a> }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+
Propchange: james/site/trunk/www/mime4j/xref/org/mime4j/field/MailboxListField.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: james/site/trunk/www/mime4j/xref/org/mime4j/field/UnstructuredField.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mime4j/xref/org/mime4j/field/UnstructuredField.html?rev=437432&view=auto
==============================================================================
--- james/site/trunk/www/mime4j/xref/org/mime4j/field/UnstructuredField.html (added)
+++ james/site/trunk/www/mime4j/xref/org/mime4j/field/UnstructuredField.html Sun Aug 27 11:20:29 2006
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>UnstructuredField xref</title>
+<link type="text/css" rel="stylesheet" href="../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../../../apidocs/org/mime4j/field/UnstructuredField.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a> <em class="comment">/*</em>
+<a name="2" href="#2">2</a> <em class="comment"> * Copyright 2004 the mime4j project</em>
+<a name="3" href="#3">3</a> <em class="comment"> *</em>
+<a name="4" href="#4">4</a> <em class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</em>
+<a name="5" href="#5">5</a> <em class="comment"> * you may not use this file except in compliance with the License.</em>
+<a name="6" href="#6">6</a> <em class="comment"> * You may obtain a copy of the License at</em>
+<a name="7" href="#7">7</a> <em class="comment"> *</em>
+<a name="8" href="#8">8</a> <em class="comment"> * <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em>
+<a name="9" href="#9">9</a> <em class="comment"> *</em>
+<a name="10" href="#10">10</a> <em class="comment"> * Unless required by applicable law or agreed to in writing, software</em>
+<a name="11" href="#11">11</a> <em class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</em>
+<a name="12" href="#12">12</a> <em class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</em>
+<a name="13" href="#13">13</a> <em class="comment"> * See the License for the specific language governing permissions and</em>
+<a name="14" href="#14">14</a> <em class="comment"> * limitations under the License.</em>
+<a name="15" href="#15">15</a> <em class="comment"> */</em>
+<a name="16" href="#16">16</a> <strong>package</strong> org.mime4j.field;
+<a name="17" href="#17">17</a>
+<a name="18" href="#18">18</a> <strong>import</strong> org.mime4j.decoder.DecoderUtil;
+<a name="19" href="#19">19</a>
+<a name="20" href="#20">20</a>
+<a name="21" href="#21">21</a> <em>/**<em>*</em></em>
+<a name="22" href="#22">22</a> <em> * Simple unstructured field such as <code>Subject</code>.</em>
+<a name="23" href="#23">23</a> <em> *</em>
+<a name="24" href="#24">24</a> <em> * @author Niklas Therning</em>
+<a name="25" href="#25">25</a> <em> * @version $Id: UnstructuredField.java,v 1.3 2004/10/25 07:26:46 ntherning Exp $</em>
+<a name="26" href="#26">26</a> <em> */</em>
+<a name="27" href="#27">27</a> <strong>public</strong> <strong>class</strong> <a href="../../../org/mime4j/field/UnstructuredField.html">UnstructuredField</a> <strong>extends</strong> <a href="../../../org/mime4j/field/Field.html">Field</a> {
+<a name="28" href="#28">28</a> <strong>private</strong> String value;
+<a name="29" href="#29">29</a>
+<a name="30" href="#30">30</a> <strong>protected</strong> <a href="../../../org/mime4j/field/UnstructuredField.html">UnstructuredField</a>() {
+<a name="31" href="#31">31</a> }
+<a name="32" href="#32">32</a>
+<a name="33" href="#33">33</a> <strong>protected</strong> <strong>void</strong> parseBody(String body) {
+<a name="34" href="#34">34</a> value = DecoderUtil.decodeEncodedWords(body);
+<a name="35" href="#35">35</a> }
+<a name="36" href="#36">36</a>
+<a name="37" href="#37">37</a> <strong>public</strong> String getValue() {
+<a name="38" href="#38">38</a> <strong>return</strong> value;
+<a name="39" href="#39">39</a> }
+<a name="40" href="#40">40</a> }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+
Propchange: james/site/trunk/www/mime4j/xref/org/mime4j/field/UnstructuredField.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: james/site/trunk/www/mime4j/xref/org/mime4j/field/address/Address.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mime4j/xref/org/mime4j/field/address/Address.html?rev=437432&view=auto
==============================================================================
--- james/site/trunk/www/mime4j/xref/org/mime4j/field/address/Address.html (added)
+++ james/site/trunk/www/mime4j/xref/org/mime4j/field/address/Address.html Sun Aug 27 11:20:29 2006
@@ -0,0 +1,61 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>Address xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../../../../../apidocs/org/mime4j/field/address/Address.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a> <em class="comment">/*</em>
+<a name="2" href="#2">2</a> <em class="comment"> * Copyright 2004 the mime4j project</em>
+<a name="3" href="#3">3</a> <em class="comment"> *</em>
+<a name="4" href="#4">4</a> <em class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</em>
+<a name="5" href="#5">5</a> <em class="comment"> * you may not use this file except in compliance with the License.</em>
+<a name="6" href="#6">6</a> <em class="comment"> * You may obtain a copy of the License at</em>
+<a name="7" href="#7">7</a> <em class="comment"> *</em>
+<a name="8" href="#8">8</a> <em class="comment"> * <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em>
+<a name="9" href="#9">9</a> <em class="comment"> *</em>
+<a name="10" href="#10">10</a> <em class="comment"> * Unless required by applicable law or agreed to in writing, software</em>
+<a name="11" href="#11">11</a> <em class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</em>
+<a name="12" href="#12">12</a> <em class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</em>
+<a name="13" href="#13">13</a> <em class="comment"> * See the License for the specific language governing permissions and</em>
+<a name="14" href="#14">14</a> <em class="comment"> * limitations under the License.</em>
+<a name="15" href="#15">15</a> <em class="comment"> */</em>
+<a name="16" href="#16">16</a> <strong>package</strong> org.mime4j.field.address;
+<a name="17" href="#17">17</a>
+<a name="18" href="#18">18</a> <strong>import</strong> java.util.ArrayList;
+<a name="19" href="#19">19</a>
+<a name="20" href="#20">20</a> <em>/**<em>*</em></em>
+<a name="21" href="#21">21</a> <em> * The abstract base for classes that represent RFC2822 addresses.</em>
+<a name="22" href="#22">22</a> <em> * This includes groups and mailboxes.</em>
+<a name="23" href="#23">23</a> <em> * </em>
+<a name="24" href="#24">24</a> <em> * Currently, no public methods are introduced on this class.</em>
+<a name="25" href="#25">25</a> <em> * </em>
+<a name="26" href="#26">26</a> <em> * @author Joe Cheng &lt;code@joecheng.com&gt;</em>
+<a name="27" href="#27">27</a> <em> */</em>
+<a name="28" href="#28">28</a> <strong>public</strong> <strong>abstract</strong> <strong>class</strong> <a href="../../../../org/mime4j/field/address/Address.html">Address</a> {
+<a name="29" href="#29">29</a>
+<a name="30" href="#30">30</a> <em>/**<em>*</em></em>
+<a name="31" href="#31">31</a> <em> * Adds any mailboxes represented by this address</em>
+<a name="32" href="#32">32</a> <em> * into the given ArrayList. Note that this method</em>
+<a name="33" href="#33">33</a> <em> * has default (package) access, so a doAddMailboxesTo</em>
+<a name="34" href="#34">34</a> <em> * method is needed to allow the behavior to be</em>
+<a name="35" href="#35">35</a> <em> * overridden by subclasses.</em>
+<a name="36" href="#36">36</a> <em> */</em>
+<a name="37" href="#37">37</a> <strong>final</strong> <strong>void</strong> addMailboxesTo(ArrayList results) {
+<a name="38" href="#38">38</a> doAddMailboxesTo(results);
+<a name="39" href="#39">39</a> }
+<a name="40" href="#40">40</a>
+<a name="41" href="#41">41</a> <em>/**<em>*</em></em>
+<a name="42" href="#42">42</a> <em> * Adds any mailboxes represented by this address</em>
+<a name="43" href="#43">43</a> <em> * into the given ArrayList. Must be overridden by</em>
+<a name="44" href="#44">44</a> <em> * concrete subclasses.</em>
+<a name="45" href="#45">45</a> <em> */</em>
+<a name="46" href="#46">46</a> <strong>protected</strong> <strong>abstract</strong> <strong>void</strong> doAddMailboxesTo(ArrayList results);
+<a name="47" href="#47">47</a>
+<a name="48" href="#48">48</a> }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+
Propchange: james/site/trunk/www/mime4j/xref/org/mime4j/field/address/Address.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: james/site/trunk/www/mime4j/xref/org/mime4j/field/address/AddressList.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mime4j/xref/org/mime4j/field/address/AddressList.html?rev=437432&view=auto
==============================================================================
--- james/site/trunk/www/mime4j/xref/org/mime4j/field/address/AddressList.html (added)
+++ james/site/trunk/www/mime4j/xref/org/mime4j/field/address/AddressList.html Sun Aug 27 11:20:29 2006
@@ -0,0 +1,159 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>AddressList xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../../../../../apidocs/org/mime4j/field/address/AddressList.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a> <em class="comment">/*</em>
+<a name="2" href="#2">2</a> <em class="comment"> * Copyright 2004 the mime4j project</em>
+<a name="3" href="#3">3</a> <em class="comment"> *</em>
+<a name="4" href="#4">4</a> <em class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</em>
+<a name="5" href="#5">5</a> <em class="comment"> * you may not use this file except in compliance with the License.</em>
+<a name="6" href="#6">6</a> <em class="comment"> * You may obtain a copy of the License at</em>
+<a name="7" href="#7">7</a> <em class="comment"> *</em>
+<a name="8" href="#8">8</a> <em class="comment"> * <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em>
+<a name="9" href="#9">9</a> <em class="comment"> *</em>
+<a name="10" href="#10">10</a> <em class="comment"> * Unless required by applicable law or agreed to in writing, software</em>
+<a name="11" href="#11">11</a> <em class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</em>
+<a name="12" href="#12">12</a> <em class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</em>
+<a name="13" href="#13">13</a> <em class="comment"> * See the License for the specific language governing permissions and</em>
+<a name="14" href="#14">14</a> <em class="comment"> * limitations under the License.</em>
+<a name="15" href="#15">15</a> <em class="comment"> */</em>
+<a name="16" href="#16">16</a> <strong>package</strong> org.mime4j.field.address;
+<a name="17" href="#17">17</a>
+<a name="18" href="#18">18</a> <strong>import</strong> org.mime4j.field.address.parser.AddressListParser;
+<a name="19" href="#19">19</a> <strong>import</strong> org.mime4j.field.address.parser.ParseException;
+<a name="20" href="#20">20</a>
+<a name="21" href="#21">21</a> <strong>import</strong> java.io.StringReader;
+<a name="22" href="#22">22</a> <strong>import</strong> java.util.ArrayList;
+<a name="23" href="#23">23</a> <strong>import</strong> java.util.Iterator;
+<a name="24" href="#24">24</a>
+<a name="25" href="#25">25</a> <em>/**<em>*</em></em>
+<a name="26" href="#26">26</a> <em> * An immutable, random-access list of Address objects.</em>
+<a name="27" href="#27">27</a> <em> *</em>
+<a name="28" href="#28">28</a> <em> * @author Joe Cheng &lt;code@joecheng.com&gt;</em>
+<a name="29" href="#29">29</a> <em> */</em>
+<a name="30" href="#30">30</a> <strong>public</strong> <strong>class</strong> <a href="../../../../org/mime4j/field/address/AddressList.html">AddressList</a> {
+<a name="31" href="#31">31</a>
+<a name="32" href="#32">32</a> <strong>private</strong> ArrayList addresses;
+<a name="33" href="#33">33</a>
+<a name="34" href="#34">34</a> <em>/**<em>*</em></em>
+<a name="35" href="#35">35</a> <em> * @param addresses An ArrayList that contains only Address objects. </em>
+<a name="36" href="#36">36</a> <em> * @param dontCopy true iff it is not possible for the addresses ArrayList to be modified by someone else.</em>
+<a name="37" href="#37">37</a> <em> */</em>
+<a name="38" href="#38">38</a> <strong>public</strong> <a href="../../../../org/mime4j/field/address/AddressList.html">AddressList</a>(ArrayList addresses, <strong>boolean</strong> dontCopy) {
+<a name="39" href="#39">39</a> <strong>if</strong> (addresses != <strong>null</strong>)
+<a name="40" href="#40">40</a> <strong>this</strong>.addresses = (dontCopy ? addresses : (ArrayList) addresses.clone());
+<a name="41" href="#41">41</a> <strong>else</strong>
+<a name="42" href="#42">42</a> <strong>this</strong>.addresses = <strong>new</strong> ArrayList(0);
+<a name="43" href="#43">43</a> }
+<a name="44" href="#44">44</a>
+<a name="45" href="#45">45</a> <strong>public</strong> Iterator iterator() {
+<a name="46" href="#46">46</a> <strong>return</strong> <strong>new</strong> Iterator() {
+<a name="47" href="#47">47</a> <strong>private</strong> <strong>int</strong> pos = 0;
+<a name="48" href="#48">48</a> <strong>public</strong> <strong>void</strong> remove() { <strong>throw</strong> <strong>new</strong> UnsupportedOperationException(); }
+<a name="49" href="#49">49</a> <strong>public</strong> <strong>boolean</strong> hasNext() { <strong>return</strong> pos < size(); }
+<a name="50" href="#50">50</a> <strong>public</strong> Object next() { <strong>return</strong> get(pos++); }
+<a name="51" href="#51">51</a> };
+<a name="52" href="#52">52</a> }
+<a name="53" href="#53">53</a>
+<a name="54" href="#54">54</a> <em>/**<em>*</em></em>
+<a name="55" href="#55">55</a> <em> * The number of elements in this list.</em>
+<a name="56" href="#56">56</a> <em> */</em>
+<a name="57" href="#57">57</a> <strong>public</strong> <strong>int</strong> size() {
+<a name="58" href="#58">58</a> <strong>return</strong> addresses.size();
+<a name="59" href="#59">59</a> }
+<a name="60" href="#60">60</a>
+<a name="61" href="#61">61</a> <em>/**<em>*</em></em>
+<a name="62" href="#62">62</a> <em> * Gets an address. </em>
+<a name="63" href="#63">63</a> <em> */</em>
+<a name="64" href="#64">64</a> <strong>public</strong> <a href="../../../../org/mime4j/field/address/Address.html">Address</a> get(<strong>int</strong> index) {
+<a name="65" href="#65">65</a> <strong>if</strong> (0 > index || size() <= index)
+<a name="66" href="#66">66</a> <strong>throw</strong> <strong>new</strong> IndexOutOfBoundsException();
+<a name="67" href="#67">67</a> <strong>return</strong> (Address) addresses.get(index);
+<a name="68" href="#68">68</a> }
+<a name="69" href="#69">69</a>
+<a name="70" href="#70">70</a> <em>/**<em>*</em></em>
+<a name="71" href="#71">71</a> <em> * Returns a flat list of all mailboxes represented</em>
+<a name="72" href="#72">72</a> <em> * in this address list. Use this if you don't care</em>
+<a name="73" href="#73">73</a> <em> * about grouping. </em>
+<a name="74" href="#74">74</a> <em> */</em>
+<a name="75" href="#75">75</a> <strong>public</strong> <a href="../../../../org/mime4j/field/address/MailboxList.html">MailboxList</a> flatten() {
+<a name="76" href="#76">76</a> <em class="comment">// in the common case, all addresses are mailboxes</em>
+<a name="77" href="#77">77</a> <strong>boolean</strong> groupDetected = false;
+<a name="78" href="#78">78</a> <strong>for</strong> (<strong>int</strong> i = 0; i < size(); i++) {
+<a name="79" href="#79">79</a> <strong>if</strong> (!(get(i) instanceof Mailbox)) {
+<a name="80" href="#80">80</a> groupDetected = <strong>true</strong>;
+<a name="81" href="#81">81</a> <strong>break</strong>;
+<a name="82" href="#82">82</a> }
+<a name="83" href="#83">83</a> }
+<a name="84" href="#84">84</a>
+<a name="85" href="#85">85</a> <strong>if</strong> (!groupDetected)
+<a name="86" href="#86">86</a> <strong>return</strong> <strong>new</strong> <a href="../../../../org/mime4j/field/address/MailboxList.html">MailboxList</a>(addresses, <strong>true</strong>);
+<a name="87" href="#87">87</a>
+<a name="88" href="#88">88</a> ArrayList results = <strong>new</strong> ArrayList();
+<a name="89" href="#89">89</a> <strong>for</strong> (<strong>int</strong> i = 0; i < size(); i++) {
+<a name="90" href="#90">90</a> Address addr = get(i);
+<a name="91" href="#91">91</a> addr.addMailboxesTo(results);
+<a name="92" href="#92">92</a> }
+<a name="93" href="#93">93</a>
+<a name="94" href="#94">94</a> <em class="comment">// copy-on-construct this time, because subclasses</em>
+<a name="95" href="#95">95</a> <em class="comment">// could have held onto a reference to the results</em>
+<a name="96" href="#96">96</a> <strong>return</strong> <strong>new</strong> <a href="../../../../org/mime4j/field/address/MailboxList.html">MailboxList</a>(results, false);
+<a name="97" href="#97">97</a> }
+<a name="98" href="#98">98</a>
+<a name="99" href="#99">99</a> <em>/**<em>*</em></em>
+<a name="100" href="#100">100</a> <em> * Dumps a representation of this address list to</em>
+<a name="101" href="#101">101</a> <em> * stdout, for debugging purposes.</em>
+<a name="102" href="#102">102</a> <em> */</em>
+<a name="103" href="#103">103</a> <strong>public</strong> <strong>void</strong> print() {
+<a name="104" href="#104">104</a> <strong>for</strong> (<strong>int</strong> i = 0; i < size(); i++) {
+<a name="105" href="#105">105</a> Address addr = get(i);
+<a name="106" href="#106">106</a> System.out.println(addr.toString());
+<a name="107" href="#107">107</a> }
+<a name="108" href="#108">108</a> }
+<a name="109" href="#109">109</a>
+<a name="110" href="#110">110</a>
+<a name="111" href="#111">111</a>
+<a name="112" href="#112">112</a> <em>/**<em>*</em></em>
+<a name="113" href="#113">113</a> <em> * Parse the address list string, such as the value </em>
+<a name="114" href="#114">114</a> <em> * of a From, To, Cc, Bcc, Sender, or Reply-To</em>
+<a name="115" href="#115">115</a> <em> * header.</em>
+<a name="116" href="#116">116</a> <em> * </em>
+<a name="117" href="#117">117</a> <em> * The string MUST be unfolded already.</em>
+<a name="118" href="#118">118</a> <em> */</em>
+<a name="119" href="#119">119</a> <strong>public</strong> <strong>static</strong> <a href="../../../../org/mime4j/field/address/AddressList.html">AddressList</a> parse(String rawAddressList) throws ParseException {
+<a name="120" href="#120">120</a> AddressListParser parser = <strong>new</strong> AddressListParser(<strong>new</strong> StringReader(rawAddressList));
+<a name="121" href="#121">121</a> <strong>return</strong> Builder.getInstance().buildAddressList(parser.parse());
+<a name="122" href="#122">122</a> }
+<a name="123" href="#123">123</a>
+<a name="124" href="#124">124</a> <em>/**<em>*</em></em>
+<a name="125" href="#125">125</a> <em> * Test console.</em>
+<a name="126" href="#126">126</a> <em> */</em>
+<a name="127" href="#127">127</a> <strong>public</strong> <strong>static</strong> <strong>void</strong> main(String[] args) throws Exception {
+<a name="128" href="#128">128</a> java.io.BufferedReader reader = <strong>new</strong> java.io.BufferedReader(<strong>new</strong> java.io.InputStreamReader(System.in));
+<a name="129" href="#129">129</a> <strong>while</strong> (<strong>true</strong>) {
+<a name="130" href="#130">130</a> <strong>try</strong> {
+<a name="131" href="#131">131</a> System.out.print(<span class="string">"> "</span>);
+<a name="132" href="#132">132</a> String line = reader.readLine();
+<a name="133" href="#133">133</a> <strong>if</strong> (line.length() == 0 || line.toLowerCase().equals(<span class="string">"exit"</span>) || line.toLowerCase().equals(<span class="string">"quit"</span>)) {
+<a name="134" href="#134">134</a> System.out.println(<span class="string">"Goodbye."</span>);
+<a name="135" href="#135">135</a> <strong>return</strong>;
+<a name="136" href="#136">136</a> }
+<a name="137" href="#137">137</a> AddressList list = parse(line);
+<a name="138" href="#138">138</a> list.print();
+<a name="139" href="#139">139</a> }
+<a name="140" href="#140">140</a> <strong>catch</strong>(Exception e) {
+<a name="141" href="#141">141</a> e.printStackTrace();
+<a name="142" href="#142">142</a> Thread.sleep(300);
+<a name="143" href="#143">143</a> }
+<a name="144" href="#144">144</a> }
+<a name="145" href="#145">145</a> }
+<a name="146" href="#146">146</a> }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+
Propchange: james/site/trunk/www/mime4j/xref/org/mime4j/field/address/AddressList.html
------------------------------------------------------------------------------
svn:eol-style = native