source: contrib/MailArchiver/sources/vendor/mime4j/apache-mime4j-0.7-SNAPSHOT-20110327.010440-17/dom/src/main/java/org/apache/james/mime4j/message/MessageImpl.java @ 6785

Revision 6785, 4.7 KB checked in by rafaelraymundo, 12 years ago (diff)

Ticket #2946 - Liberado codigo do MailArchiver?. Documentação na subpasta DOCS.

Line 
1/****************************************************************
2 * Licensed to the Apache Software Foundation (ASF) under one   *
3 * or more contributor license agreements.  See the NOTICE file *
4 * distributed with this work for additional information        *
5 * regarding copyright ownership.  The ASF licenses this file   *
6 * to you under the Apache License, Version 2.0 (the            *
7 * "License"); you may not use this file except in compliance   *
8 * with the License.  You may obtain a copy of the License at   *
9 *                                                              *
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 ****************************************************************/
19
20package org.apache.james.mime4j.message;
21
22import java.util.Collection;
23import java.util.Date;
24import java.util.Map;
25import java.util.TimeZone;
26
27import org.apache.james.mime4j.dom.address.Address;
28import org.apache.james.mime4j.dom.address.Mailbox;
29import org.apache.james.mime4j.dom.field.AddressListField;
30import org.apache.james.mime4j.dom.field.ContentDispositionField;
31import org.apache.james.mime4j.dom.field.ContentTransferEncodingField;
32import org.apache.james.mime4j.dom.field.ContentTypeField;
33import org.apache.james.mime4j.dom.field.DateTimeField;
34import org.apache.james.mime4j.dom.field.FieldName;
35import org.apache.james.mime4j.dom.field.MailboxField;
36import org.apache.james.mime4j.dom.field.MailboxListField;
37import org.apache.james.mime4j.dom.field.UnstructuredField;
38import org.apache.james.mime4j.field.ContentTransferEncodingFieldImpl;
39import org.apache.james.mime4j.field.ContentTypeFieldImpl;
40import org.apache.james.mime4j.field.Fields;
41import org.apache.james.mime4j.util.MimeUtil;
42
43/**
44 * Represents a MIME message.
45 */
46public class MessageImpl extends AbstractMessage {
47
48    /**
49     * Creates a new empty <code>Message</code>.
50     */
51    public MessageImpl() {
52    }
53
54    @Override
55    protected String newUniqueBoundary() {
56        return MimeUtil.createUniqueBoundary();
57    }
58
59    @Override
60    protected UnstructuredField newMessageId(String hostname) {
61        return Fields.messageId(hostname);
62    }
63
64    @Override
65    protected DateTimeField newDate(Date date, TimeZone zone) {
66        return Fields.date(FieldName.DATE, date, zone);
67    }
68
69    @Override
70    protected MailboxField newMailbox(String fieldName, Mailbox mailbox) {
71        return Fields.mailbox(fieldName, mailbox);
72    }
73
74    @Override
75    protected MailboxListField newMailboxList(String fieldName,
76            Collection<Mailbox> mailboxes) {
77        return Fields.mailboxList(fieldName, mailboxes);
78    }
79
80    @Override
81    protected AddressListField newAddressList(String fieldName,
82            Collection<Address> addresses) {
83        return Fields.addressList(fieldName, addresses);
84    }
85
86    @Override
87    protected UnstructuredField newSubject(String subject) {
88        return Fields.subject(subject);
89    }
90
91    @Override
92    protected ContentDispositionField newContentDisposition(
93            String dispositionType, String filename, long size,
94            Date creationDate, Date modificationDate, Date readDate) {
95        return Fields.contentDisposition(dispositionType, filename, size,
96                creationDate, modificationDate, readDate);
97    }
98
99    @Override
100    protected ContentDispositionField newContentDisposition(
101            String dispositionType, Map<String, String> parameters) {
102        return Fields.contentDisposition(dispositionType, parameters);
103    }
104
105    @Override
106    protected ContentTypeField newContentType(String mimeType,
107            Map<String, String> parameters) {
108        return Fields.contentType(mimeType, parameters);
109    }
110
111    @Override
112    protected ContentTransferEncodingField newContentTransferEncoding(
113            String contentTransferEncoding) {
114        return Fields.contentTransferEncoding(contentTransferEncoding);
115    }
116
117    @Override
118    protected String calcTransferEncoding(ContentTransferEncodingField f) {
119        return ContentTransferEncodingFieldImpl.getEncoding(f);
120    }
121
122    @Override
123    protected String calcMimeType(ContentTypeField child, ContentTypeField parent) {
124        return ContentTypeFieldImpl.getMimeType(child, parent);
125    }
126
127    @Override
128    protected String calcCharset(ContentTypeField contentType) {
129        return ContentTypeFieldImpl.getCharset(contentType);
130    }
131
132}
Note: See TracBrowser for help on using the repository browser.