public class MimeHeaders
extends java.lang.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(java.lang.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(java.lang.String name,
int starting)
Find the index of a header with the given name.
|
java.lang.String |
getHeader(java.lang.String name) |
MessageBytes |
getName(int n) |
MessageBytes |
getUniqueValue(java.lang.String name)
Finds and returns a unique header field with the given name.
|
MessageBytes |
getValue(int n) |
MessageBytes |
getValue(java.lang.String name)
Finds and returns a header field with the given name.
|
java.util.Enumeration<java.lang.String> |
names()
Returns an enumeration of strings representing the header field names.
|
void |
recycle()
Clears all header fields.
|
void |
removeHeader(int idx)
reset and swap with last header
|
void |
removeHeader(java.lang.String name)
Removes a header field with the specified name.
|
void |
setLimit(int limit)
Set limit on the number of header fields.
|
MessageBytes |
setValue(java.lang.String name)
Allow "set" operations, which removes all current values
for this header.
|
int |
size() |
java.lang.String |
toString()
EXPENSIVE!!!
|
java.util.Enumeration<java.lang.String> |
values(java.lang.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 java.lang.String toString()
toString
in class java.lang.Object
public void duplicate(MimeHeaders source) throws java.io.IOException
java.io.IOException
public int size()
public MessageBytes getName(int n)
n
- The header indexpublic MessageBytes getValue(int n)
n
- The header indexpublic int findHeader(java.lang.String name, int starting)
name
- The header namestarting
- Index on which to start lookingpublic java.util.Enumeration<java.lang.String> names()
public java.util.Enumeration<java.lang.String> values(java.lang.String name)
public MessageBytes addValue(java.lang.String name)
name
- The header namepublic MessageBytes addValue(byte[] b, int startN, int len)
b
- The header name bytesstartN
- Offsetlen
- Lengthpublic MessageBytes setValue(java.lang.String name)
name
- The header namepublic MessageBytes getValue(java.lang.String name)
name
- The header namepublic MessageBytes getUniqueValue(java.lang.String name)
IllegalArgumentException
is thrown.name
- The header namejava.lang.IllegalArgumentException
- if the header has multiple valuespublic java.lang.String getHeader(java.lang.String name)
public void removeHeader(java.lang.String name)
name
- the name of the header field to be removedpublic void removeHeader(int idx)
idx
- the index of the header to remove.Copyright © 2000-1970 Apache Software Foundation. All Rights Reserved.