Skip to content

Package: MessageHeaders

MessageHeaders

nameinstructionbranchcomplexitylinemethod
MessageHeaders()
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
MessageHeaders(InputStream)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
MessageHeaders(InternetHeaders)
M: 12 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getContentStream()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getInputStream()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getSize()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
setDataHandler(DataHandler)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: package org.eclipse.angus.mail.dsn;
18:
19: import java.io.*;
20:
21: import jakarta.activation.*;
22: import jakarta.mail.*;
23: import jakarta.mail.internet.*;
24:
25: /**
26: * A special MimeMessage object that contains only message headers,
27: * no content. Used to represent the MIME type text/rfc822-headers.
28: *
29: * @since        JavaMail 1.4
30: */
31: public class MessageHeaders extends MimeMessage {
32:
33: /**
34: * Construct a MessageHeaders object.
35: *
36: * @exception        MessagingException for failures
37: */
38: public MessageHeaders() throws MessagingException {
39:         super((Session)null);
40:         content = new byte[0];
41: }
42:
43: /**
44: * Constructs a MessageHeaders object from the given InputStream.
45: *
46: * @param        is        InputStream
47: * @exception        MessagingException for failures
48: */
49: public MessageHeaders(InputStream is) throws MessagingException {
50:         super(null, is);
51:         content = new byte[0];
52: }
53:
54: /**
55: * Constructs a MessageHeaders object using the given InternetHeaders.
56: *
57: * @param        headers        InternetHeaders to use
58: * @exception        MessagingException for failures
59: */
60: public MessageHeaders(InternetHeaders headers) throws MessagingException {
61:         super((Session)null);
62:         this.headers = headers;
63:         content = new byte[0];
64: }
65:
66: /**
67: * Return the size of this message.
68: * Always returns zero.
69: */
70: public int getSize() {
71:         return 0;
72: }
73:
74: public InputStream getInputStream() {
75:         return new ByteArrayInputStream(content);
76: }
77:
78: protected InputStream getContentStream() {
79:         return new ByteArrayInputStream(content);
80: }
81:
82: /**
83: * Can't set any content for a MessageHeaders object.
84: *
85: * @exception        MessagingException        always
86: */
87: public void setDataHandler(DataHandler dh) throws MessagingException {
88:         throw new MessagingException("Can't set content for MessageHeaders");
89: }
90:
91: }