com.sun.xml.messaging.saaj.packaging.mime.util.BEncoderStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of saaj-impl Show documentation
Show all versions of saaj-impl Show documentation
Open source Reference Implementation of JSR-67: SOAP with Attachments API for Java (SAAJ MR: 1.4)
/*
* Copyright (c) 1997, 2018 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
*/
/*
* @(#)BEncoderStream.java 1.3 02/03/27
*/
package com.sun.xml.messaging.saaj.packaging.mime.util;
import java.io.OutputStream;
/**
* This class implements a 'B' Encoder as defined by RFC2047 for
* encoding MIME headers. It subclasses the BASE64EncoderStream
* class.
*
* @author John Mani
*/
public class BEncoderStream extends BASE64EncoderStream {
/**
* Create a 'B' encoder that encodes the specified input stream.
* @param out the output stream
*/
public BEncoderStream(OutputStream out) {
super(out, Integer.MAX_VALUE); // MAX_VALUE is 2^31, should
// suffice (!) to indicate that
// CRLFs should not be inserted
}
/**
* Returns the length of the encoded version of this byte array.
*
* @param b byte array.
*
* @return length of the byte array.
*/
public static int encodedLength(byte[] b) {
return ((b.length + 2)/3) * 4;
}
}