You don't need to track this. Use byteStream.size() instead. The elementLength is not accounting for the separator byte and the null bytes, etc. The byteStream.size() will always be correct - no need to try to double track this.