
Milad G. answered 03/11/20
Software Engineer + Computer Science Degree | Crypto/Meta Consultant
HI,
This sounds like a good candidate for StringBuffer, basically, the string buffer add allows you to add data to it efficiently and then at the end of your stream you can convert from StringBuffer to String. StringBuffer guarantees synchronizations I believe where as a similar class StringBuilder does not. Check the java docs for the specs of these two built in classes.