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

org.bouncycastle.mime.MimeWriter Maven / Gradle / Ivy

Go to download

The Bouncy Castle Java APIs for CMS, PKCS, EAC, TSP, CMP, CRMF, OCSP, and certificate generation. This jar contains APIs for JDK 1.5 to JDK 1.8. The APIs can be used in conjunction with a JCE/JCA provider such as the one provided with the Bouncy Castle Cryptography APIs.

There is a newer version: 1.70
Show newest version
package org.bouncycastle.mime;

import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public abstract class MimeWriter
{
    protected final Headers headers;

    protected MimeWriter(Headers headers)
    {
        this.headers = headers;
    }

    public Headers getHeaders()
    {
        return headers;
    }

    public abstract OutputStream getContentStream()
        throws IOException;


    protected static List mapToLines(Map headers)
    {
        List hdrs = new ArrayList(headers.size());

        for (Iterator it = headers.keySet().iterator(); it.hasNext();)
        {
            String key = (String)it.next();

            hdrs.add(key + ": " + headers.get(key));
        }

        return hdrs;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy