Writer implementation (doesn't put a CRC at the end yet)