java_gen.PrimitiveSinkUtils: add support for putting nullable Strings, better support for null

Reviewer: @meiyangbigswitch @rlane
Based on a conversation with @rlane, prepend optional entries with a
presence bit + length instead of the null-byte delimitation.