com.sun.xml.internal.messaging.saaj.util.FinalArrayList Java Examples

The following examples show how to use com.sun.xml.internal.messaging.saaj.util.FinalArrayList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InternetHeaders.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return all the values for the specified header. The
 * values are String objects.  Returns <code>null</code>
 * if no headers with the specified name exist.
 *
 * @param   name header name
 * @return          array of header values, or null if none
 */
public String[] getHeader(String name) {
    // XXX - should we just step through in index order?
    FinalArrayList v = new FinalArrayList(); // accumulate return values

    int len = headers.size();
    for( int i=0; i<len; i++ ) {
        hdr h = (hdr) headers.get(i);
        if (name.equalsIgnoreCase(h.name)) {
            v.add(h.getValue());
        }
    }
    if (v.size() == 0)
        return (null);
    // convert Vector to an array for return
    return (String[]) v.toArray(new String[v.size()]);
}
 
Example #2
Source File: InternetHeaders.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return all the values for the specified header. The
 * values are String objects.  Returns <code>null</code>
 * if no headers with the specified name exist.
 *
 * @param   name header name
 * @return          array of header values, or null if none
 */
public String[] getHeader(String name) {
    // XXX - should we just step through in index order?
    FinalArrayList v = new FinalArrayList(); // accumulate return values

    int len = headers.size();
    for( int i=0; i<len; i++ ) {
        hdr h = (hdr) headers.get(i);
        if (name.equalsIgnoreCase(h.name)) {
            v.add(h.getValue());
        }
    }
    if (v.size() == 0)
        return (null);
    // convert Vector to an array for return
    return (String[]) v.toArray(new String[v.size()]);
}
 
Example #3
Source File: InternetHeaders.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return all the values for the specified header. The
 * values are String objects.  Returns <code>null</code>
 * if no headers with the specified name exist.
 *
 * @param   name header name
 * @return          array of header values, or null if none
 */
public String[] getHeader(String name) {
    // XXX - should we just step through in index order?
    FinalArrayList v = new FinalArrayList(); // accumulate return values

    int len = headers.size();
    for( int i=0; i<len; i++ ) {
        hdr h = (hdr) headers.get(i);
        if (name.equalsIgnoreCase(h.name)) {
            v.add(h.getValue());
        }
    }
    if (v.size() == 0)
        return (null);
    // convert Vector to an array for return
    return (String[]) v.toArray(new String[v.size()]);
}
 
Example #4
Source File: InternetHeaders.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return all the values for the specified header. The
 * values are String objects.  Returns <code>null</code>
 * if no headers with the specified name exist.
 *
 * @param   name header name
 * @return          array of header values, or null if none
 */
public String[] getHeader(String name) {
    // XXX - should we just step through in index order?
    FinalArrayList<String> v = new FinalArrayList<String>(); // accumulate return values

    int len = headers.size();
    for( int i=0; i<len; i++ ) {
        hdr h = headers.get(i);
        if (name.equalsIgnoreCase(h.name)) {
            v.add(h.getValue());
        }
    }
    if (v.size() == 0)
        return (null);
    // convert Vector to an array for return
    return v.toArray(new String[v.size()]);
}
 
Example #5
Source File: InternetHeaders.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return all the values for the specified header. The
 * values are String objects.  Returns <code>null</code>
 * if no headers with the specified name exist.
 *
 * @param   name header name
 * @return          array of header values, or null if none
 */
public String[] getHeader(String name) {
    // XXX - should we just step through in index order?
    FinalArrayList v = new FinalArrayList(); // accumulate return values

    int len = headers.size();
    for( int i=0; i<len; i++ ) {
        hdr h = (hdr) headers.get(i);
        if (name.equalsIgnoreCase(h.name)) {
            v.add(h.getValue());
        }
    }
    if (v.size() == 0)
        return (null);
    // convert Vector to an array for return
    return (String[]) v.toArray(new String[v.size()]);
}
 
Example #6
Source File: InternetHeaders.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return all the values for the specified header. The
 * values are String objects.  Returns <code>null</code>
 * if no headers with the specified name exist.
 *
 * @param   name header name
 * @return          array of header values, or null if none
 */
public String[] getHeader(String name) {
    // XXX - should we just step through in index order?
    FinalArrayList v = new FinalArrayList(); // accumulate return values

    int len = headers.size();
    for( int i=0; i<len; i++ ) {
        hdr h = (hdr) headers.get(i);
        if (name.equalsIgnoreCase(h.name)) {
            v.add(h.getValue());
        }
    }
    if (v.size() == 0)
        return (null);
    // convert Vector to an array for return
    return (String[]) v.toArray(new String[v.size()]);
}
 
Example #7
Source File: InternetHeaders.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return all the values for the specified header. The
 * values are String objects.  Returns <code>null</code>
 * if no headers with the specified name exist.
 *
 * @param   name header name
 * @return          array of header values, or null if none
 */
public String[] getHeader(String name) {
    // XXX - should we just step through in index order?
    FinalArrayList v = new FinalArrayList(); // accumulate return values

    int len = headers.size();
    for( int i=0; i<len; i++ ) {
        hdr h = (hdr) headers.get(i);
        if (name.equalsIgnoreCase(h.name)) {
            v.add(h.getValue());
        }
    }
    if (v.size() == 0)
        return (null);
    // convert Vector to an array for return
    return (String[]) v.toArray(new String[v.size()]);
}
 
Example #8
Source File: InternetHeaders.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return all the values for the specified header. The
 * values are String objects.  Returns <code>null</code>
 * if no headers with the specified name exist.
 *
 * @param   name header name
 * @return          array of header values, or null if none
 */
public String[] getHeader(String name) {
    // XXX - should we just step through in index order?
    FinalArrayList v = new FinalArrayList(); // accumulate return values

    int len = headers.size();
    for( int i=0; i<len; i++ ) {
        hdr h = (hdr) headers.get(i);
        if (name.equalsIgnoreCase(h.name)) {
            v.add(h.getValue());
        }
    }
    if (v.size() == 0)
        return (null);
    // convert Vector to an array for return
    return (String[]) v.toArray(new String[v.size()]);
}
 
Example #9
Source File: MimeBodyPart.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the languages specified in the Content-Language header
 * of this MimeBodyPart. The Content-Language header is defined by
 * RFC 1766. Returns <code>null</code> if this header is not
 * available or its value is absent. <p>
 *
 * This implementation uses <code>getHeader(name)</code>
 * to obtain the requisite header field.
 */
public String[] getContentLanguage() throws MessagingException {
    String s = getHeader("Content-Language", null);

    if (s == null)
        return null;

    // Tokenize the header to obtain the Language-tags (skip comments)
    HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME);
    FinalArrayList v = new FinalArrayList();

    HeaderTokenizer.Token tk;
    int tkType;

    while (true) {
        tk = h.next(); // get a language-tag
        tkType = tk.getType();
        if (tkType == HeaderTokenizer.Token.EOF)
        break; // done
        else if (tkType == HeaderTokenizer.Token.ATOM) v.add(tk.getValue());
        else // invalid token, skip it.
        continue;
    }

    if (v.size() == 0)
        return null;

    return (String[])v.toArray(new String[v.size()]);
}
 
Example #10
Source File: MimeBodyPart.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the languages specified in the Content-Language header
 * of this MimeBodyPart. The Content-Language header is defined by
 * RFC 1766. Returns <code>null</code> if this header is not
 * available or its value is absent. <p>
 *
 * This implementation uses <code>getHeader(name)</code>
 * to obtain the requisite header field.
 *
 * @return array of language tags
 * @exception MessagingException in case of error
 */
public String[] getContentLanguage() throws MessagingException {
    String s = getHeader("Content-Language", null);

    if (s == null)
        return null;

    // Tokenize the header to obtain the Language-tags (skip comments)
    HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME);
    FinalArrayList<String> v = new FinalArrayList<String>();

    HeaderTokenizer.Token tk;
    int tkType;

    while (true) {
        tk = h.next(); // get a language-tag
        tkType = tk.getType();
        if (tkType == HeaderTokenizer.Token.EOF)
        break; // done
        else if (tkType == HeaderTokenizer.Token.ATOM) v.add(tk.getValue());
        else // invalid token, skip it.
        continue;
    }

    if (v.size() == 0)
        return null;

    return v.toArray(new String[v.size()]);
}
 
Example #11
Source File: MimeMultipart.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds a MimeBodyPart to the multipart.  The MimeBodyPart is appended to
 * the list of existing Parts.
 *
 * @param  part  The MimeBodyPart to be appended
 */
public synchronized void addBodyPart(MimeBodyPart part) {
    if (parts == null)
        parts = new FinalArrayList<MimeBodyPart>();

    parts.add(part);
    part.setParent(this);
}
 
Example #12
Source File: MimeBodyPart.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the languages specified in the Content-Language header
 * of this MimeBodyPart. The Content-Language header is defined by
 * RFC 1766. Returns <code>null</code> if this header is not
 * available or its value is absent. <p>
 *
 * This implementation uses <code>getHeader(name)</code>
 * to obtain the requisite header field.
 */
public String[] getContentLanguage() throws MessagingException {
    String s = getHeader("Content-Language", null);

    if (s == null)
        return null;

    // Tokenize the header to obtain the Language-tags (skip comments)
    HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME);
    FinalArrayList v = new FinalArrayList();

    HeaderTokenizer.Token tk;
    int tkType;

    while (true) {
        tk = h.next(); // get a language-tag
        tkType = tk.getType();
        if (tkType == HeaderTokenizer.Token.EOF)
        break; // done
        else if (tkType == HeaderTokenizer.Token.ATOM) v.add(tk.getValue());
        else // invalid token, skip it.
        continue;
    }

    if (v.size() == 0)
        return null;

    return (String[])v.toArray(new String[v.size()]);
}
 
Example #13
Source File: MimeBodyPart.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the languages specified in the Content-Language header
 * of this MimeBodyPart. The Content-Language header is defined by
 * RFC 1766. Returns <code>null</code> if this header is not
 * available or its value is absent. <p>
 *
 * This implementation uses <code>getHeader(name)</code>
 * to obtain the requisite header field.
 */
public String[] getContentLanguage() throws MessagingException {
    String s = getHeader("Content-Language", null);

    if (s == null)
        return null;

    // Tokenize the header to obtain the Language-tags (skip comments)
    HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME);
    FinalArrayList v = new FinalArrayList();

    HeaderTokenizer.Token tk;
    int tkType;

    while (true) {
        tk = h.next(); // get a language-tag
        tkType = tk.getType();
        if (tkType == HeaderTokenizer.Token.EOF)
        break; // done
        else if (tkType == HeaderTokenizer.Token.ATOM) v.add(tk.getValue());
        else // invalid token, skip it.
        continue;
    }

    if (v.size() == 0)
        return null;

    return (String[])v.toArray(new String[v.size()]);
}
 
Example #14
Source File: MimeBodyPart.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the languages specified in the Content-Language header
 * of this MimeBodyPart. The Content-Language header is defined by
 * RFC 1766. Returns <code>null</code> if this header is not
 * available or its value is absent. <p>
 *
 * This implementation uses <code>getHeader(name)</code>
 * to obtain the requisite header field.
 */
public String[] getContentLanguage() throws MessagingException {
    String s = getHeader("Content-Language", null);

    if (s == null)
        return null;

    // Tokenize the header to obtain the Language-tags (skip comments)
    HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME);
    FinalArrayList v = new FinalArrayList();

    HeaderTokenizer.Token tk;
    int tkType;

    while (true) {
        tk = h.next(); // get a language-tag
        tkType = tk.getType();
        if (tkType == HeaderTokenizer.Token.EOF)
        break; // done
        else if (tkType == HeaderTokenizer.Token.ATOM) v.add(tk.getValue());
        else // invalid token, skip it.
        continue;
    }

    if (v.size() == 0)
        return null;

    return (String[])v.toArray(new String[v.size()]);
}
 
Example #15
Source File: MimeBodyPart.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the languages specified in the Content-Language header
 * of this MimeBodyPart. The Content-Language header is defined by
 * RFC 1766. Returns <code>null</code> if this header is not
 * available or its value is absent. <p>
 *
 * This implementation uses <code>getHeader(name)</code>
 * to obtain the requisite header field.
 */
public String[] getContentLanguage() throws MessagingException {
    String s = getHeader("Content-Language", null);

    if (s == null)
        return null;

    // Tokenize the header to obtain the Language-tags (skip comments)
    HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME);
    FinalArrayList v = new FinalArrayList();

    HeaderTokenizer.Token tk;
    int tkType;

    while (true) {
        tk = h.next(); // get a language-tag
        tkType = tk.getType();
        if (tkType == HeaderTokenizer.Token.EOF)
        break; // done
        else if (tkType == HeaderTokenizer.Token.ATOM) v.add(tk.getValue());
        else // invalid token, skip it.
        continue;
    }

    if (v.size() == 0)
        return null;

    return (String[])v.toArray(new String[v.size()]);
}
 
Example #16
Source File: MimeBodyPart.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the languages specified in the Content-Language header
 * of this MimeBodyPart. The Content-Language header is defined by
 * RFC 1766. Returns <code>null</code> if this header is not
 * available or its value is absent. <p>
 *
 * This implementation uses <code>getHeader(name)</code>
 * to obtain the requisite header field.
 */
public String[] getContentLanguage() throws MessagingException {
    String s = getHeader("Content-Language", null);

    if (s == null)
        return null;

    // Tokenize the header to obtain the Language-tags (skip comments)
    HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME);
    FinalArrayList v = new FinalArrayList();

    HeaderTokenizer.Token tk;
    int tkType;

    while (true) {
        tk = h.next(); // get a language-tag
        tkType = tk.getType();
        if (tkType == HeaderTokenizer.Token.EOF)
        break; // done
        else if (tkType == HeaderTokenizer.Token.ATOM) v.add(tk.getValue());
        else // invalid token, skip it.
        continue;
    }

    if (v.size() == 0)
        return null;

    return (String[])v.toArray(new String[v.size()]);
}
 
Example #17
Source File: MimeBodyPart.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the languages specified in the Content-Language header
 * of this MimeBodyPart. The Content-Language header is defined by
 * RFC 1766. Returns <code>null</code> if this header is not
 * available or its value is absent. <p>
 *
 * This implementation uses <code>getHeader(name)</code>
 * to obtain the requisite header field.
 */
public String[] getContentLanguage() throws MessagingException {
    String s = getHeader("Content-Language", null);

    if (s == null)
        return null;

    // Tokenize the header to obtain the Language-tags (skip comments)
    HeaderTokenizer h = new HeaderTokenizer(s, HeaderTokenizer.MIME);
    FinalArrayList v = new FinalArrayList();

    HeaderTokenizer.Token tk;
    int tkType;

    while (true) {
        tk = h.next(); // get a language-tag
        tkType = tk.getType();
        if (tkType == HeaderTokenizer.Token.EOF)
        break; // done
        else if (tkType == HeaderTokenizer.Token.ATOM) v.add(tk.getValue());
        else // invalid token, skip it.
        continue;
    }

    if (v.size() == 0)
        return null;

    return (String[])v.toArray(new String[v.size()]);
}
 
Example #18
Source File: MimeMultipart.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Adds a MimeBodyPart at position <code>index</code>.
 * If <code>index</code> is not the last one in the list,
 * the subsequent parts are shifted up. If <code>index</code>
 * is larger than the number of parts present, the
 * MimeBodyPart is appended to the end.
 *
 * @param  part  The MimeBodyPart to be inserted
 * @param  index Location where to insert the part
 */
public synchronized void addBodyPart(MimeBodyPart part, int index) {
    if (parts == null)
        parts = new FinalArrayList<MimeBodyPart>();

    parts.add(index,part);
    part.setParent(this);
}
 
Example #19
Source File: InternetHeaders.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return all the headers as an Enumeration of
 * {@link Header} objects.
 *
 * @return  Header objects
 */
public FinalArrayList getAllHeaders() {
    return headers; // conceptually it should be read-only, but for performance reason I'm not wrapping it here
}
 
Example #20
Source File: MimeBodyPart.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return all the headers from this Message as an Enumeration of
 * Header objects.
 */
public FinalArrayList getAllHeaders() {
    return headers.getAllHeaders();
}
 
Example #21
Source File: InternetHeaders.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return all the headers as an Enumeration of
 * {@link Header} objects.
 *
 * @return  Header objects
 */
public FinalArrayList getAllHeaders() {
    return headers; // conceptually it should be read-only, but for performance reason I'm not wrapping it here
}
 
Example #22
Source File: MimeBodyPart.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return all the headers from this Message as an Enumeration of
 * Header objects.
 */
public FinalArrayList getAllHeaders() {
    return headers.getAllHeaders();
}
 
Example #23
Source File: MimeBodyPart.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return all the headers from this Message as an Enumeration of
 * Header objects.
 */
public FinalArrayList getAllHeaders() {
    return headers.getAllHeaders();
}
 
Example #24
Source File: InternetHeaders.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return all the headers as an Enumeration of
 * {@link Header} objects.
 *
 * @return  Header objects
 */
public FinalArrayList<hdr> getAllHeaders() {
    return headers; // conceptually it should be read-only, but for performance reason I'm not wrapping it here
}
 
Example #25
Source File: InternetHeaders.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return all the headers as an Enumeration of
 * {@link Header} objects.
 *
 * @return  Header objects
 */
public FinalArrayList getAllHeaders() {
    return headers; // conceptually it should be read-only, but for performance reason I'm not wrapping it here
}
 
Example #26
Source File: MimeBodyPart.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return all the headers from this Message as an Enumeration of
 * Header objects.
 *
 * @return all headers
 */
public FinalArrayList<hdr> getAllHeaders() {
    return headers.getAllHeaders();
}
 
Example #27
Source File: MimeBodyPart.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return all the headers from this Message as an Enumeration of
 * Header objects.
 */
public FinalArrayList getAllHeaders() {
    return headers.getAllHeaders();
}
 
Example #28
Source File: InternetHeaders.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return all the headers as an Enumeration of
 * {@link Header} objects.
 *
 * @return  Header objects
 */
public FinalArrayList getAllHeaders() {
    return headers; // conceptually it should be read-only, but for performance reason I'm not wrapping it here
}
 
Example #29
Source File: MimeBodyPart.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return all the headers from this Message as an Enumeration of
 * Header objects.
 */
public FinalArrayList getAllHeaders() {
    return headers.getAllHeaders();
}
 
Example #30
Source File: InternetHeaders.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return all the headers as an Enumeration of
 * {@link Header} objects.
 *
 * @return  Header objects
 */
public FinalArrayList getAllHeaders() {
    return headers; // conceptually it should be read-only, but for performance reason I'm not wrapping it here
}