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

org.xbib.net.mime.stream.MimeStream Maven / Gradle / Ivy

package org.xbib.net.mime.stream;

import org.xbib.net.mime.MimeException;

import java.io.InputStream;

public class MimeStream {

    private MimeStream() {
    }

    public static InputStream decode(InputStream inputStream, String encoding) throws MimeException {
        if (encoding.equalsIgnoreCase("base64"))
            return new Base64DecoderStream(inputStream);
        else if (encoding.equalsIgnoreCase("quoted-printable"))
            return new QuotedPrintableInputStream(inputStream);
        else if (encoding.equalsIgnoreCase("binary") ||
                encoding.equalsIgnoreCase("7bit") ||
                encoding.equalsIgnoreCase("8bit"))
            return inputStream;
        else {
            throw new MimeException("Unknown encoding: " + encoding);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy