QpackUtil.java — netty Source File
Architecture documentation for QpackUtil.java, a java file in the netty codebase.
Entity Profile
Relationship Graph
Source Code
/*
* Copyright 2020 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.handler.codec.http3;
import io.netty.buffer.ByteBuf;
import io.netty.util.AsciiString;
import io.netty.util.internal.ConstantTimeUtils;
import io.netty.util.internal.PlatformDependent;
import static io.netty.util.internal.ObjectUtil.checkInRange;
import static java.lang.Math.floorDiv;
final class QpackUtil {
private static final QpackException PREFIXED_INTEGER_TOO_LONG =
QpackException.newStatic(QpackDecoder.class, "toIntOrThrow(...)",
"QPACK - invalid prefixed integer");
/**
* Encode integer according to
* <a href="https://tools.ietf.org/html/rfc7541#section-5.1">Section 5.1</a>.
*/
static void encodePrefixedInteger(ByteBuf out, byte mask, int prefixLength, long toEncode) {
checkInRange(toEncode, 0, MAX_UNSIGNED_INT, "toEncode");
int nbits = (1 << prefixLength) - 1;
if (toEncode < nbits) {
out.writeByte((byte) (mask | toEncode));
} else {
out.writeByte((byte) (mask | nbits));
long remainder = toEncode - nbits;
while (remainder > 128) {
byte next = (byte) ((remainder % 128) | 0x80);
out.writeByte(next);
remainder = remainder / 128;
}
out.writeByte((byte) remainder);
}
}
/**
* Decode the integer or return {@code -1} if not enough bytes are readable.
* This method increases the readerIndex when the integer could be decoded.
*
* @param in the input {@link ByteBuf}
* @param prefixLength the prefix length
* @return the integer or {@code -1} if not enough readable bytes are in the {@link ByteBuf).
*/
static int decodePrefixedIntegerAsInt(ByteBuf in, int prefixLength) throws QpackException {
// ... (409 more lines)
Domain
Subdomains
Classes
Types
Source
Frequently Asked Questions
What does QpackUtil.java do?
QpackUtil.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Allocators subdomain.
Where is QpackUtil.java in the architecture?
QpackUtil.java is located at codec-http3/src/main/java/io/netty/handler/codec/http3/QpackUtil.java (domain: Buffer, subdomain: Allocators, directory: codec-http3/src/main/java/io/netty/handler/codec/http3).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free