If the stream encounters a token that exceeds maxTokenSize, it appears the caller has no way of truncating or skipping the token: The error is final. There's no way to alter maxTokenSize, either. As far as I can see, the only solution is to not use Segmenter at all, but to write new streaming logic from scratch.