Use ByteSource methods to create test input

Also avoids excessive system calls due to unbuffered writes.  Finally
migrate repeatingArrayByteSource to ByteSources.