added java docs, improved implementation (tweaks), added PrependAppendOutputProcessor and unit test for it

Change-Id: I1a271a0523ded2ac5364c3ca85f4f097b388d525