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

Method bytes

netty/src/main/java/io/grpc/netty/Utils.java:269–277  ·  view source on GitHub ↗
(CharSequence seq)

Source from the content-addressed store, hash-verified

267 }
268
269 private static byte[] bytes(CharSequence seq) {
270 if (seq instanceof AsciiString) {
271 // Fast path - sometimes copy.
272 AsciiString str = (AsciiString) seq;
273 return str.isEntireArrayUsed() ? str.array() : str.toByteArray();
274 }
275 // Slow path - copy.
276 return seq.toString().getBytes(UTF_8);
277 }
278
279 public static Http2Headers convertClientHeaders(Metadata headers,
280 AsciiString scheme,

Callers 1

convertHeadersToArrayMethod · 0.95

Calls 4

getBytesMethod · 0.80
arrayMethod · 0.65
toByteArrayMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected