Example usage for javax.mail BodyPart getMatchingHeaders

List of usage examples for javax.mail BodyPart getMatchingHeaders

Introduction

In this page you can find the example usage for javax.mail BodyPart getMatchingHeaders.

Prototype

public Enumeration<Header> getMatchingHeaders(String[] header_names) throws MessagingException;

Source Link

Document

Return matching headers from this part as an Enumeration of Header objects.

Usage

From source file:org.sourceforge.net.javamail4ews.transport.EwsTransport.java

@SuppressWarnings("unchecked")
private String getFirstHeaderValue(BodyPart part, String pKey) throws MessagingException {
    Enumeration<Header> lMatchingHeaders = part.getMatchingHeaders(new String[] { pKey });

    if (lMatchingHeaders.hasMoreElements()) {
        Header lHeader = lMatchingHeaders.nextElement();
        String lValue = lHeader.getValue();

        return lValue;
    }//from   w ww. j  a  va2  s.co m
    return null;
}