Don't generate the cooked bytes unless you have to, use a memoizing supplier from Guava. Also don't recook the bytes if you don't have to, if someone hands you the cooked bytes, save them and have the supplier return those.