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