Make writePrimitive*() and readPrimitive*() methods public.

These utility methods are useful for client code to read/write arrays of
primitive types.