'Write the contents of buffer i to disk.'

def DumpBuffer(self, i):

    buf_index = self.buffer_index[i]
    if (buf_index == 0):
        return
    buf = self.buffers[i]
    output_prefix = os.path.join(self.output_dir, self.names[i])
    output_filename = ('%s-%.5d-of-%.5d' % (output_prefix, (self.dump_count[i] + 1), self.max_dumps[i]))
    self.dump_count[i] += 1
    np.save(output_filename, buf[:buf_index])
    self.buffer_index[i] = 0
    self.data_written[i] += buf_index
