Package: RFC822DATA
RFC822DATA
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
RFC822DATA(FetchResponse) |
|
|
|
|
|
||||||||||||||||||||
RFC822DATA(FetchResponse, boolean) |
|
|
|
|
|
||||||||||||||||||||
getByteArray() |
|
|
|
|
|
||||||||||||||||||||
getByteArrayInputStream() |
|
|
|
|
|
||||||||||||||||||||
isHeader() |
|
|
|
|
|
||||||||||||||||||||
static {...} |
|
|
|
|
|
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.imap.protocol;
18:
19: import java.io.ByteArrayInputStream;
20: import org.eclipse.angus.mail.iap.*;
21: import org.eclipse.angus.mail.iap.ByteArray;
22: import org.eclipse.angus.mail.iap.ParsingException;
23:
24: /**
25: * The RFC822 response data item.
26: *
27: * @author John Mani
28: * @author Bill Shannon
29: */
30:
31: public class RFC822DATA implements Item {
32:
33: static final char[] name = {'R','F','C','8','2','2'};
34: private final int msgno;
35: private final ByteArray data;
36: private final boolean isHeader;
37:
38: /**
39: * Constructor, header flag is false.
40: *
41: * @param        r        the FetchResponse
42: * @exception ParsingException for parsing failures
43: */
44: public RFC822DATA(FetchResponse r) throws ParsingException {
45:         this(r, false);
46: }
47:
48: /**
49: * Constructor, specifying header flag.
50: *
51: * @param        r        the FetchResponse
52: * @param        isHeader        just header information?
53: * @exception        ParsingException        for parsing failures
54: */
55: public RFC822DATA(FetchResponse r, boolean isHeader)
56:                                 throws ParsingException {
57:         this.isHeader = isHeader;
58:         msgno = r.getNumber();
59:         r.skipSpaces();
60:         data = r.readByteArray();
61: }
62:
63: public ByteArray getByteArray() {
64:         return data;
65: }
66:
67: public ByteArrayInputStream getByteArrayInputStream() {
68:•        if (data != null)
69:          return data.toByteArrayInputStream();
70:         else
71:          return null;
72: }
73:
74: public boolean isHeader() {
75:         return isHeader;
76: }
77: }