Class GrpcHttp2HeadersUtils.GrpcHttp2InboundHeaders
java.lang.Object
io.grpc.netty.AbstractHttp2Headers
io.grpc.netty.GrpcHttp2HeadersUtils.GrpcHttp2InboundHeaders
- All Implemented Interfaces:
io.netty.handler.codec.Headers<CharSequence, CharSequence, io.netty.handler.codec.http2.Http2Headers>, io.netty.handler.codec.http2.Http2Headers, Iterable<Map.Entry<CharSequence, CharSequence>>
- Direct Known Subclasses:
GrpcHttp2HeadersUtils.GrpcHttp2RequestHeaders, GrpcHttp2HeadersUtils.GrpcHttp2ResponseHeaders
- Enclosing class:
GrpcHttp2HeadersUtils
A
Http2Headers implementation optimized for inbound/received headers.
Header names and values are stored in simple arrays, which makes insert run in O(1)
and retrievial a O(n). Header name equality is not determined by the equals implementation of
CharSequence type, but by comparing two names byte to byte.
All CharSequence input parameters and return values are required to be of type
AsciiString.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.handler.codec.http2.Http2Headers
io.netty.handler.codec.http2.Http2Headers.PseudoHeaderName -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final io.netty.util.AsciiStringprivate byte[][]private intprivate io.netty.util.AsciiString[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected io.netty.handler.codec.http2.Http2Headersadd(io.netty.util.AsciiString name, io.netty.util.AsciiString value) private voidaddHeader(io.netty.util.AsciiString value, byte[] nameBytes, byte[] valueBytes) protected static voidappendNameAndValue(StringBuilder builder, CharSequence name, CharSequence value, boolean prependSeparator) protected static byte[]bytes(io.netty.util.AsciiString str) booleancontains(CharSequence name) protected static booleanequals(byte[] bytes0, int offset0, int length0, byte[] bytes1, int offset1, int length1) protected static booleanequals(io.netty.util.AsciiString str0, byte[] str1) protected static booleanequals(io.netty.util.AsciiString str0, io.netty.util.AsciiString str1) private voidprotected CharSequenceget(io.netty.util.AsciiString name) getAll(CharSequence csName) protected static booleanisPseudoHeader(io.netty.util.AsciiString str) iterator()(package private) byte[][]Returns the header names and values as bytes.private List<Map.Entry<CharSequence, CharSequence>> protected final Stringprotected intReturns the number of none-null headers innamesAndValues().booleanremove(CharSequence csName) protected static io.netty.util.AsciiStringio.netty.handler.codec.http2.Http2Headersset(CharSequence name, CharSequence value) io.netty.handler.codec.http2.Http2HeaderssetLong(CharSequence name, long value) intsize()status()protected io.netty.util.AsciiStringvalidateName(io.netty.util.AsciiString str) Methods inherited from class AbstractHttp2Headers
add, add, add, add, addBoolean, addByte, addChar, addDouble, addFloat, addInt, addLong, addObject, addObject, addObject, addShort, addTimeMillis, authority, authority, clear, contains, contains, containsBoolean, containsByte, containsChar, containsDouble, containsFloat, containsInt, containsLong, containsObject, containsShort, containsTimeMillis, get, get, getAllAndRemove, getAndRemove, getAndRemove, getBoolean, getBoolean, getBooleanAndRemove, getBooleanAndRemove, getByte, getByte, getByteAndRemove, getByteAndRemove, getChar, getChar, getCharAndRemove, getCharAndRemove, getDouble, getDouble, getDoubleAndRemove, getDoubleAndRemove, getFloat, getFloat, getFloatAndRemove, getFloatAndRemove, getInt, getInt, getIntAndRemove, getIntAndRemove, getLong, getLong, getLongAndRemove, getLongAndRemove, getShort, getShort, getShortAndRemove, getShortAndRemove, getTimeMillis, getTimeMillis, getTimeMillisAndRemove, getTimeMillisAndRemove, isEmpty, method, method, names, path, path, scheme, scheme, set, set, set, setAll, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setObject, setObject, setObject, setShort, setTimeMillis, status, valueIteratorMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
binaryHeaderSuffix
private static final io.netty.util.AsciiString binaryHeaderSuffix -
namesAndValues
private byte[][] namesAndValues -
values
private io.netty.util.AsciiString[] values -
namesAndValuesIdx
private int namesAndValuesIdx
-
-
Constructor Details
-
GrpcHttp2InboundHeaders
GrpcHttp2InboundHeaders(int numHeadersGuess)
-
-
Method Details
-
add
protected io.netty.handler.codec.http2.Http2Headers add(io.netty.util.AsciiString name, io.netty.util.AsciiString value) -
addHeader
private void addHeader(io.netty.util.AsciiString value, byte[] nameBytes, byte[] valueBytes) -
get
-
contains
- Specified by:
containsin interfaceio.netty.handler.codec.Headers<CharSequence, CharSequence, io.netty.handler.codec.http2.Http2Headers>- Overrides:
containsin classAbstractHttp2Headers
-
status
- Specified by:
statusin interfaceio.netty.handler.codec.http2.Http2Headers- Overrides:
statusin classAbstractHttp2Headers
-
getAll
- Specified by:
getAllin interfaceio.netty.handler.codec.Headers<CharSequence, CharSequence, io.netty.handler.codec.http2.Http2Headers>- Overrides:
getAllin classAbstractHttp2Headers
-
remove
- Specified by:
removein interfaceio.netty.handler.codec.Headers<CharSequence, CharSequence, io.netty.handler.codec.http2.Http2Headers>- Overrides:
removein classAbstractHttp2Headers
-
set
- Specified by:
setin interfaceio.netty.handler.codec.Headers<CharSequence, CharSequence, io.netty.handler.codec.http2.Http2Headers>- Overrides:
setin classAbstractHttp2Headers
-
setLong
- Specified by:
setLongin interfaceio.netty.handler.codec.Headers<CharSequence, CharSequence, io.netty.handler.codec.http2.Http2Headers>- Overrides:
setLongin classAbstractHttp2Headers
-
namesAndValues
byte[][] namesAndValues()Returns the header names and values as bytes. An even numbered index contains thebyte[]representation of a header name (in insertion order), and the subsequent odd index number contains the corresponding header value.The values of binary headers (with a -bin suffix), are already base64 decoded.
The array may contain several
nullvalues at the end. Anullvalue an index means that all higher numbered indices also containnullvalues. -
numHeaders
protected int numHeaders()Returns the number of none-null headers innamesAndValues(). -
equals
protected static boolean equals(io.netty.util.AsciiString str0, byte[] str1) -
equals
protected static boolean equals(io.netty.util.AsciiString str0, io.netty.util.AsciiString str1) -
equals
protected static boolean equals(byte[] bytes0, int offset0, int length0, byte[] bytes1, int offset1, int length1) -
bytes
protected static byte[] bytes(io.netty.util.AsciiString str) -
requireAsciiString
-
isPseudoHeader
protected static boolean isPseudoHeader(io.netty.util.AsciiString str) -
validateName
protected io.netty.util.AsciiString validateName(io.netty.util.AsciiString str) -
expandHeadersAndValues
private void expandHeadersAndValues() -
size
public int size()- Specified by:
sizein interfaceio.netty.handler.codec.Headers<CharSequence, CharSequence, io.netty.handler.codec.http2.Http2Headers>- Overrides:
sizein classAbstractHttp2Headers
-
iterator
- Specified by:
iteratorin interfaceio.netty.handler.codec.Headers<CharSequence, CharSequence, io.netty.handler.codec.http2.Http2Headers>- Specified by:
iteratorin interfaceio.netty.handler.codec.http2.Http2Headers- Specified by:
iteratorin interfaceIterable<Map.Entry<CharSequence, CharSequence>>- Overrides:
iteratorin classAbstractHttp2Headers
-
appendNameAndValue
protected static void appendNameAndValue(StringBuilder builder, CharSequence name, CharSequence value, boolean prependSeparator) -
namesAndValuesToImmutableList
-
namesAndValuesToString
-