public void AddDone()
 {
     if (@out != null)
     {
         @out.Dispose();
         @out = null;
     }
 }
        public virtual void Flush(Stream stream)
        {
            OutputStreamDataOutput dos = new OutputStreamDataOutput(stream);

            try
            {
                dos.WriteInt(this.counter);

                // write the labelRepository
                this.labelRepository.Flush(dos);
                // Closes the data output stream
                dos.Dispose();

            }
            finally
            {
                dos.Dispose();
            }
        }
 /// <summary>
 /// Sole constructor. 
 /// </summary>
 public DiskOrdinalMap(string tmpfile)
 {
     this.tmpfile = tmpfile;
     var outfs = new FileStream(tmpfile, FileMode.OpenOrCreate, FileAccess.Write);
     @out = new OutputStreamDataOutput(outfs);
 }
 internal virtual void Flush(OutputStreamDataOutput @out)
 {
     using (var ms = StreamUtils.SerializeToStream(this))
     {
         var bytes = ms.ToArray();
         @out.WriteBytes(bytes, 0, bytes.Length);
     }
 }