Also, are you sure the file is really empty? It's possible that it's filled with NULL chars (value 0) and you're looking at it with a viewer that makes it look like nothing's there. Double-check the size of the file, as well as the array size as Rob suggests.
Also as suggested by Barry in another
thread, call bos.close() at the end. (The flush() call
should have the same basic effect for our purposes, but maybe not...)