001    /**
002     *
003     * Copyright 2003-2004 The Apache Software Foundation
004     *
005     *  Licensed under the Apache License, Version 2.0 (the "License");
006     *  you may not use this file except in compliance with the License.
007     *  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    
018    package javax.mail.internet;
019    
020    import java.text.FieldPosition;
021    import java.text.NumberFormat;
022    import java.text.ParsePosition;
023    import java.text.SimpleDateFormat;
024    import java.util.Calendar;
025    import java.util.Date;
026    import java.util.Locale;
027    
028    /**
029     * Formats ths date as specified by
030     * draft-ietf-drums-msg-fmt-08 dated January 26, 2000
031     * which supercedes RFC822.
032     * <p/>
033     * <p/>
034     * The format used is <code>EEE, d MMM yyyy HH:mm:ss Z</code> and
035     * locale is always US-ASCII.
036     *
037     * @version $Rev: 125583 $ $Date: 2005-01-18 19:44:27 -0800 (Tue, 18 Jan 2005) $
038     */
039    public class MailDateFormat extends SimpleDateFormat {
040        public MailDateFormat() {
041            super("EEE, d MMM yyyy HH:mm:ss Z", Locale.US);
042        }
043    
044        public StringBuffer format(Date date, StringBuffer buffer, FieldPosition position) {
045            return super.format(date, buffer, position);
046        }
047    
048        public Date parse(String string, ParsePosition position) {
049            return super.parse(string, position);
050        }
051    
052        /**
053         * The calendar cannot be set
054         * @param calendar
055         * @throws UnsupportedOperationException
056         */
057        public void setCalendar(Calendar calendar) {
058            throw new UnsupportedOperationException();
059        }
060    
061        /**
062         * The format cannot be set
063         * @param format
064         * @throws UnsupportedOperationException
065         */
066        public void setNumberFormat(NumberFormat format) {
067            throw new UnsupportedOperationException();
068        }
069    }