(Http2Headers http2Headers)
| 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) { |
no test coverage detected