This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
You are calling document.getBinaryBlob() twice; your 2nd call should read textfile.getBinaryStream();
Either "document" or "outStream" is null in that block. You should be able to work out which from the stack trace which gives line numbers.
And in future, please provide more details; it would have been much easier to answer with copy of the stack trace. And please use the code button when you quote code like that; it makes it much easier to read.