Rewrote RawBuffer to use a list

* The array is now lazily computed
* If the buffer ends up in a file, no intermediate byte arrays are
  created
* Also fixed a bug when reading the file back in as a byte array