01: /****************************************************************
02: * Licensed to the Apache Software Foundation (ASF) under one *
03: * or more contributor license agreements. See the NOTICE file *
04: * distributed with this work for additional information *
05: * regarding copyright ownership. The ASF licenses this file *
06: * to you under the Apache License, Version 2.0 (the *
07: * "License"); you may not use this file except in compliance *
08: * with the License. You may obtain a copy of the License at *
09: * *
10: * http://www.apache.org/licenses/LICENSE-2.0 *
11: * *
12: * Unless required by applicable law or agreed to in writing, *
13: * software distributed under the License is distributed on an *
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
15: * KIND, either express or implied. See the License for the *
16: * specific language governing permissions and limitations *
17: * under the License. *
18: ****************************************************************/package org.apache.mailet.dates;
19:
20: import java.util.Date;
21:
22: import javax.mail.internet.MailDateFormat;
23:
24: /**
25: * A thread safe wrapper for the <code>javax.mail.internet.MailDateFormat</code> class.
26: *
27: */
28: public class RFC822DateFormat extends SynchronizedDateFormat {
29: /**
30: * A static instance of the RFC822DateFormat, used by toString
31: */
32: private static RFC822DateFormat instance;
33:
34: static {
35: instance = new RFC822DateFormat();
36: }
37:
38: /**
39: * This static method allows us to format RFC822 dates without
40: * explicitly instantiating an RFC822DateFormat object.
41: *
42: * @return java.lang.String
43: * @param d Date
44: *
45: * @deprecated This method is not necessary and is preserved for API
46: * backwards compatibility. Users of this class should
47: * instantiate an instance and use it as they would any
48: * other DateFormat object.
49: */
50: public static String toString(Date d) {
51: return instance.format(d);
52: }
53:
54: /**
55: * Constructor for RFC822DateFormat
56: */
57: public RFC822DateFormat() {
58: super (new MailDateFormat());
59: }
60: }
|