* @throws IOException
*/
private byte[] generateHeaderBlock(WyilFile module)
throws IOException {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
BinaryOutputStream output = new BinaryOutputStream(bytes);
// second, write the file version number
output.write_uv(MAJOR_VERSION);
output.write_uv(MINOR_VERSION);
// third, write the various pool sizes
output.write_uv(stringPool.size());
output.write_uv(pathPool.size());
output.write_uv(namePool.size());
output.write_uv(typePool.size());
output.write_uv(constantPool.size());
// finally, write the number of remaining blocks
output.write_uv(module.blocks().size());
writeStringPool(output);
writePathPool(output);
writeNamePool(output);
writeTypePool(output);
writeConstantPool(output);
output.close();
return bytes.toByteArray();
}