utf8BytesNonAscii() — netty Function Reference
Architecture documentation for the utf8BytesNonAscii() function in ByteBufUtil.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 0da47e3d_b4bd_90e4_3000_aca6d4e3cd1d["utf8BytesNonAscii()"] 920454f6_25f6_4a9b_3d32_9684c3e11f6c["ByteBufUtil"] 0da47e3d_b4bd_90e4_3000_aca6d4e3cd1d -->|defined in| 920454f6_25f6_4a9b_3d32_9684c3e11f6c e5a26d38_968d_e748_84db_676493308e82["utf8ByteCount()"] e5a26d38_968d_e748_84db_676493308e82 -->|calls| 0da47e3d_b4bd_90e4_3000_aca6d4e3cd1d style 0da47e3d_b4bd_90e4_3000_aca6d4e3cd1d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java lines 1192–1224
private static int utf8BytesNonAscii(final CharSequence seq, final int start, final int end) {
int encodedLength = 0;
for (int i = start; i < end; i++) {
final char c = seq.charAt(i);
// making it 100% branchless isn't rewarding due to the many bit operations necessary!
if (c < 0x800) {
// branchless version of: (c <= 127 ? 0:1) + 1
encodedLength += ((0x7f - c) >>> 31) + 1;
} else if (isSurrogate(c)) {
if (!Character.isHighSurrogate(c)) {
encodedLength++;
// WRITE_UTF_UNKNOWN
continue;
}
// Surrogate Pair consumes 2 characters.
if (++i == end) {
encodedLength++;
// WRITE_UTF_UNKNOWN
break;
}
if (!Character.isLowSurrogate(seq.charAt(i))) {
// WRITE_UTF_UNKNOWN + (Character.isHighSurrogate(c2) ? WRITE_UTF_UNKNOWN : c2)
encodedLength += 2;
continue;
}
// See https://www.unicode.org/versions/Unicode7.0.0/ch03.pdf#G2630.
encodedLength += 4;
} else {
encodedLength += 3;
}
}
return encodedLength;
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does utf8BytesNonAscii() do?
utf8BytesNonAscii() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/ByteBufUtil.java.
Where is utf8BytesNonAscii() defined?
utf8BytesNonAscii() is defined in buffer/src/main/java/io/netty/buffer/ByteBufUtil.java at line 1192.
What calls utf8BytesNonAscii()?
utf8BytesNonAscii() is called by 1 function(s): utf8ByteCount.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free