public class MimeHeaders extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_HEADER_SIZE
Initial size - should be == average number of headers per request
XXX make it configurable ( fine-tuning of web-apps )
|
Constructor and Description |
---|
MimeHeaders()
Creates a new MimeHeaders object using a default buffer size.
|
Modifier and Type | Method and Description |
---|---|
MessageBytes |
addValue(byte[] b,
int startN,
int len)
Create a new named header using un-translated byte[].
|
MessageBytes |
addValue(String name)
Create a new named header , return the MessageBytes
container for the new value
|
void |
clear()
Clears all header fields.
|
void |
duplicate(MimeHeaders source) |
int |
findHeader(String name,
int starting)
Find the index of a header with the given name.
|
String |
getHeader(String name) |
MessageBytes |
getName(int n) |
MessageBytes |
getUniqueValue(String name)
Finds and returns a unique header field with the given name.
|
MessageBytes |
getValue(int n) |
MessageBytes |
getValue(String name)
Finds and returns a header field with the given name.
|
Enumeration<String> |
names()
Returns an enumeration of strings representing the header field names.
|
void |
recycle()
Clears all header fields.
|
void |
removeHeader(String name)
Removes a header field with the specified name.
|
void |
setLimit(int limit)
Set limit on the number of header fields.
|
MessageBytes |
setValue(String name)
Allow "set" operations, which removes all current values
for this header.
|
int |
size() |
String |
toString()
EXPENSIVE!!!
|
Enumeration<String> |
values(String name) |
public static final int DEFAULT_HEADER_SIZE
public MimeHeaders()
public void setLimit(int limit)
limit
- The new limitpublic void recycle()
public void clear()
public String toString()
public void duplicate(MimeHeaders source) throws IOException
IOException
public int size()
public MessageBytes getName(int n)
n
- The header indexpublic MessageBytes getValue(int n)
n
- The header indexpublic int findHeader(String name, int starting)
name
- The header namestarting
- Index on which to start lookingpublic Enumeration<String> names()
public Enumeration<String> values(String name)
public MessageBytes addValue(String name)
name
- The header namepublic MessageBytes addValue(byte[] b, int startN, int len)
b
- The header name bytesstartN
- Offsetlen
- Lengthpublic MessageBytes setValue(String name)
name
- The header namepublic MessageBytes getValue(String name)
name
- The header namepublic MessageBytes getUniqueValue(String name)
IllegalArgumentException
is thrown.name
- The header nameIllegalArgumentException
- if the header has multiple valuespublic void removeHeader(String name)
name
- the name of the header field to be removedCopyright © 2000-2016 Apache Software Foundation. All Rights Reserved.