Skip to content

Package: LineOutputStream

LineOutputStream

Coverage

1: /*
2: * Copyright (c) 2021 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 jakarta.mail.util;
18:
19: import java.io.IOException;
20:
21: /**
22: * This interface is to support writing out Strings as a sequence of bytes
23: * terminated by a CRLF sequence. The String must contain only US-ASCII
24: * characters.
25: * <br>
26: * The expected use is to write out RFC822 style headers to an output
27: * stream.
28: */
29: public interface LineOutputStream {
30:
31:         /**
32:          * Writes the input string and a new line (CRLF).
33:          * @param s the string to write before the new line.
34:          * @throws IOException if an I/O error occurs.
35:          */
36: void writeln(String s) throws IOException;
37:
38: /**
39: * Writes a new line (CRLF).
40: * @throws IOException if an I/O error occurs.
41: */
42: void writeln() throws IOException;
43:
44: /**
45: * Writes <code>b.length</code> bytes to this output stream.
46: * @param content the content to write.
47: * @throws IOException if an I/O error occurs.
48: */
49: void write(byte[] content) throws IOException;
50:
51: }