It would be nice to be able to combine build-in-memory, and creator of trie into one step, to be used for cases where disk-backed version is not necessary.
For this I can use ByteAggregator from StoreMate (or other projects I use it on).
Its benefit over ByteArrayOutputStream is that there's no need for constant reallocation, copying, as it is segment-based. This helps with GC. Plus it could even use off-heap buffer segments if that seems necessary.