Sorry, I haven't had the time I would like to review. It would be good to make jdk10. I keep wishing what we do for performance here wouldn't get so messy. I keep thinking we should add some methods to the public Charset classes, e.g. canDecode(byte[], int, int) with one general purpose implementation and high-performance implementations for UTF-8, ASCII, Latin1 ASCII checking via hasNegatives has some hotspot help and that should be available as a high performance public API somewhere. One possibility is my canDecode suggestion.
+ if (b >= 0) + putChar(dst, dp++, (char)b); + else + putChar(dst, dp++, repl); why not coalesce into putChar(dst, dp++, (b >= 0) ? (char)b : repl)