MCPcopy Create free account
hub / github.com/grpc/grpc-java / convertHeadersToArray

Method convertHeadersToArray

netty/src/main/java/io/grpc/netty/Utils.java:256–267  ·  view source on GitHub ↗
(Http2Headers http2Headers)

Source from the content-addressed store, hash-verified

254 }
255
256 @CheckReturnValue
257 private static byte[][] convertHeadersToArray(Http2Headers http2Headers) {
258 // The Netty AsciiString class is really just a wrapper around a byte[] and supports
259 // arbitrary binary data, not just ASCII.
260 byte[][] headerValues = new byte[http2Headers.size() * 2][];
261 int i = 0;
262 for (Map.Entry<CharSequence, CharSequence> entry : http2Headers) {
263 headerValues[i++] = bytes(entry.getKey());
264 headerValues[i++] = bytes(entry.getValue());
265 }
266 return toRawSerializedHeaders(headerValues);
267 }
268
269 private static byte[] bytes(CharSequence seq) {
270 if (seq instanceof AsciiString) {

Callers 2

convertHeadersMethod · 0.95
convertTrailersMethod · 0.95

Calls 5

bytesMethod · 0.95
sizeMethod · 0.65
getKeyMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected