Top Description Inners Fields Constructors Methods
jakarta.xml.soap

public Class MimeHeaders

extends Object
Class Inheritance
Imports
java.util.Iterator, .Vector

A container for MimeHeader objects, which represent the MIME headers present in a MIME part of a message.

This class is used primarily when an application wants to retrieve specific attachments based on certain MIME headers and values. This class will most likely be used by implementations of AttachmentPart and other MIME dependent parts of the SAAJ API.

Since
1.6
See Also
SOAPMessage#getAttachments, AttachmentPart

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private Vector<MimeHeader>

Constructor Summary

AccessConstructor and Description
public
MimeHeaders()

Constructs a default MimeHeaders object initialized with an empty Vector object.

Method Summary

Modifier and TypeMethod and Description
public void
addHeader(String
a String with the name of the header to be added
name
,
String
a String with the value of the header to be added
value
)

Adds a MimeHeader object with the specified name and value to this MimeHeaders object's list of headers.

public Iterator<MimeHeader>

Returns:

an Iterator object over this MimeHeaders object's list of MimeHeader objects
getAllHeaders
()

Returns all the MimeHeaders in this MimeHeaders object.

public String[]

Returns:

a String array with all of the values for the specified header
getHeader
(String
the name of the header for which values will be returned
name
)

Returns all of the values for the specified header as an array of String objects.

public Iterator<MimeHeader>

Returns:

an Iterator object over the MimeHeader objects whose name matches one of the names in the given list
getMatchingHeaders
(String[]
an array of String objects with the names for which to search
names
)

Returns all the MimeHeader objects whose name matches a name in the given array of names.

public Iterator<MimeHeader>

Returns:

an Iterator object over the MimeHeader objects whose name does not match one of the names in the given list
getNonMatchingHeaders
(String[]
an array of String objects with the names for which to search
names
)

Returns all of the MimeHeader objects whose name does not match a name in the given array of names.

public void
removeAllHeaders()

Removes all the header entries from this MimeHeaders object.

public void
removeHeader(String
a String with the name of the header for which to search
name
)

Remove all MimeHeader objects whose name matches the given name.

public void
setHeader(String
a String with the name of the header for which to search
name
,
String
a String with the value that will replace the current value of the specified header
value
)

Replaces the current value of the first header entry whose name matches the given name with the given value, adding a new header if no existing header name matches.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

headersback to summary
private Vector<MimeHeader> headers

Constructor Detail

MimeHeadersback to summary
public MimeHeaders()

Constructs a default MimeHeaders object initialized with an empty Vector object.

Method Detail

addHeaderback to summary
public void addHeader(String name, String value)

Adds a MimeHeader object with the specified name and value to this MimeHeaders object's list of headers.

Note that RFC822 headers can contain only US-ASCII characters.

Parameters
name:String

a String with the name of the header to be added

value:String

a String with the value of the header to be added

Exceptions
IllegalArgumentException:
if there was a problem in the mime header name or value being added
getAllHeadersback to summary
public Iterator<MimeHeader> getAllHeaders()

Returns all the MimeHeaders in this MimeHeaders object.

Returns:Iterator<MimeHeader>

an Iterator object over this MimeHeaders object's list of MimeHeader objects

getHeaderback to summary
public String[] getHeader(String name)

Returns all of the values for the specified header as an array of String objects.

Parameters
name:String

the name of the header for which values will be returned

Returns:String[]

a String array with all of the values for the specified header

See Also
setHeader
getMatchingHeadersback to summary
public Iterator<MimeHeader> getMatchingHeaders(String[] names)

Returns all the MimeHeader objects whose name matches a name in the given array of names.

Parameters
names:String[]

an array of String objects with the names for which to search

Returns:Iterator<MimeHeader>

an Iterator object over the MimeHeader objects whose name matches one of the names in the given list

getNonMatchingHeadersback to summary
public Iterator<MimeHeader> getNonMatchingHeaders(String[] names)

Returns all of the MimeHeader objects whose name does not match a name in the given array of names.

Parameters
names:String[]

an array of String objects with the names for which to search

Returns:Iterator<MimeHeader>

an Iterator object over the MimeHeader objects whose name does not match one of the names in the given list

removeAllHeadersback to summary
public void removeAllHeaders()

Removes all the header entries from this MimeHeaders object.

removeHeaderback to summary
public void removeHeader(String name)

Remove all MimeHeader objects whose name matches the given name.

Parameters
name:String

a String with the name of the header for which to search

setHeaderback to summary
public void setHeader(String name, String value)

Replaces the current value of the first header entry whose name matches the given name with the given value, adding a new header if no existing header name matches. This method also removes all matching headers after the first one.

Note that RFC822 headers can contain only US-ASCII characters.

Parameters
name:String

a String with the name of the header for which to search

value:String

a String with the value that will replace the current value of the specified header

Exceptions
IllegalArgumentException:
if there was a problem in the mime header name or the value being set
See Also
getHeader
jakarta.xml.soap back to summary

pack-priv Class MimeHeaders.MatchingIterator

extends Object
implements Iterator<MimeHeader>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private final Iterator<MimeHeader>
private final boolean
private final String[]
private MimeHeader

Constructor Summary

AccessConstructor and Description
pack-priv
MatchingIterator(String[] names, boolean match, Iterator<MimeHeader> i)

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public MimeHeader
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
private MimeHeader
public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

iteratorback to summary
private final Iterator<MimeHeader> iterator
matchback to summary
private final boolean match
namesback to summary
private final String[] names
nextHeaderback to summary
private MimeHeader nextHeader

Constructor Detail

MatchingIteratorback to summary
pack-priv MatchingIterator(String[] names, boolean match, Iterator<MimeHeader> i)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public MimeHeader next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:MimeHeader

the next element in the iteration

Annotations
@Override
nextMatchback to summary
private MimeHeader nextMatch()
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override