- All Known Implementing Classes:
- SunMiscUTF8Encoder, VanillaUTF8Encoder
public interface UTF8Encoder
A non-thread-safe UTF8 encoding interface, delegates to near-zero GC overhead
UTF8 implementations on HotSpot, falls back to stdlib encoder if on other JVM.
This implementation solves a major GC bottleneck in that we don't have to
allocate objects to encode most strings.
We currently do "bulk" encoding, where the whole string is turned
into UTF-8 before it gets returned. This is simply a limitation in
PackStream currently in that we need to know the length of utf-8
strings up-front, so we can't stream them out.
This becomes an issue for very large strings, and should be remedied
in Bolt V2 by introducing streaming options for Strings in the same
manner we've discussed adding streaming lists.
Once that is resolved, we could have a method here that took a
WritableByteChannel or similar instead.