All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.xml.messaging.saaj.packaging.mime.util.OutputUtil Maven / Gradle / Ivy

There is a newer version: 4.0.3
Show newest version
/*
 * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0, which is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

/*
 * @(#)OutputUtil.java  1.6 02/03/27
 */



package com.sun.xml.messaging.saaj.packaging.mime.util;

import java.io.OutputStream;
import java.io.IOException;

/**
 * This class is to support writing out Strings as a sequence of bytes
 * terminated by a CRLF sequence. The String must contain only US-ASCII
 * characters.

* * The expected use is to write out RFC822 style headers to an output * stream.

* * @author Kohsuke Kawaguchi */ public abstract class OutputUtil { private static byte[] newline = {'\r','\n'}; public static void writeln(String s,OutputStream out) throws IOException { writeAsAscii(s,out); writeln(out); } /** * Writes a string as ASCII string. * * @param s string. * @param out output stream. * * @throws IOException if an I/O error occurs. */ public static void writeAsAscii(String s,OutputStream out) throws IOException { int len = s.length(); for( int i=0; i





© 2015 - 2024 Weber Informatics LLC | Privacy Policy