public class Headers
extends java.lang.Object
IDs: id-1 | id-2 | id-3 | ... | id-n | Headers: hdr-1 | hdr-2 | hdr-3 | ... | hdr-n |
The arrays are populated from left to right, and any 0 slots in 'ids' can terminate an interation, or signal empty slots.
It is assumed that we only have a few headers, 3-4 on average. Note that getting a header for a given key and
putting a new key/header are operations with O(n) cost, so this implementation is not recommended for
a large number of elements.
This class is not synchronized
限定符和类型 | 方法和说明 |
---|---|
int |
capacity() |
Headers |
copy() |
Header |
getHeader(short id)
Returns the header associated with an ID
|
java.util.Map<java.lang.Short,Header> |
getHeaders() |
Header[] |
getRawHeaders() |
short[] |
getRawIDs() |
int |
marshalledSize() |
java.lang.String |
printHeaders() |
java.lang.String |
printObjectHeaders() |
void |
putHeader(short id,
Header hdr)
Puts a header given a key into the hashmap.
|
Header |
putHeaderIfAbsent(short id,
Header hdr)
Puts a header given a key into the map, only if the key doesn't exist yet
|
int |
size() |
int |
size(short... excluded_ids) |
java.lang.String |
toString() |
public Headers(int capacity)
public Headers(Headers other)
public short[] getRawIDs()
public Header[] getRawHeaders()
public Header getHeader(short id)
id
- The IDpublic java.util.Map<java.lang.Short,Header> getHeaders()
public java.lang.String printHeaders()
public void putHeader(short id, Header hdr)
public Header putHeaderIfAbsent(short id, Header hdr)
id
- hdr
- public Headers copy()
public int marshalledSize()
public int size()
public int size(short... excluded_ids)
public int capacity()
public java.lang.String printObjectHeaders()
public java.lang.String toString()
toString
在类中 java.lang.Object