Internally we've implemented the package private method java.lang.StringCoding.countPositives for efficiently counting positive bytes in a byte array. This has been developed and deployed to support the needs of built-in charset encoders/decoders, where counting positives is a quick ASCII test. It appears there's utility for such a method elsewhere - not the least in non-builtin decoders and encoders - so we should consider exposing this as a public API.
Suggestion to add a public method to java.util.Arrays, delegating when appropriate to the internal method in java.lang.StringCoding
Suggestion to add a public method to java.util.Arrays, delegating when appropriate to the internal method in java.lang.StringCoding
- csr for
-
JDK-8303821 Add method for counting leading non-negative bytes in byte arrays
-
- Draft
-