WriteVLong() public method

Writes an long in a variable-length format. Writes between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.

The format is described further in DataOutput#writeVInt(int).

public WriteVLong ( long i ) : void
i long
return void
 public override bool Store(DataOutput output)
 {
     lock (this)
     {
         output.WriteVLong(count);
         if (this.normalCompletion == null || normalCompletion.FST == null)
         {
             return false;
         }
         normalCompletion.FST.Save(output);
         return true;
     }
 }
 public override void Write(DataOutput indexOut, bool absolute)
 {
     if (absolute)
     {
         indexOut.WriteVInt(upto);
         indexOut.WriteVLong(fp);
     }
     else if (fp == lastFP)
     {
         // same block
         Debug.Assert(upto >= lastUpto);
         int uptoDelta = upto - lastUpto;
         indexOut.WriteVInt(uptoDelta << 1 | 1);
     }
     else
     {
         // new block
         indexOut.WriteVInt(upto << 1);
         indexOut.WriteVLong(fp - lastFP);
     }
     lastUpto = upto;
     lastFP = fp;
 }
 public override void Write(DataOutput indexOut, bool absolute)
 {
     if (absolute)
     {
         indexOut.WriteVLong(fp);
     }
     else
     {
         indexOut.WriteVLong(fp - lastFP);
     }
     lastFP = fp;
 }
示例#4
0
 public override bool Store(DataOutput output)
 {
     lock (this)
     {
         output.WriteVLong(count);
         WriteRecursively(output, root);
         return true;
     }
 }
 public override bool Store(DataOutput output)
 {
     output.WriteVLong(count);
     JaspellTernarySearchTrie.TSTNode root = trie.Root;
     if (root == null) // empty tree
     {
         return false;
     }
     WriteRecursively(output, root);
     return true;
 }
 public override void EncodeTerm(long[] empty, DataOutput output, FieldInfo fieldInfo, BlockTermState _state,
     bool absolute)
 {
     PulsingTermState state = (PulsingTermState) _state;
     Debug.Debug.Assert((empty.Length == 0);
     this.absolute = this.absolute || absolute;
     if (state.bytes == null)
     {
         _wrappedPostingsWriter.EncodeTerm(longs, buffer, fieldInfo, state.wrappedState, this.absolute);
         for (int i = 0; i < longsSize; i++)
         {
             output.WriteVLong(longs[i]);
         }
         buffer.WriteTo(output);
         buffer.Reset();
         this.absolute = false;
     }
     else
     {
         output.WriteVInt(state.bytes.Length);
         output.WriteBytes(state.bytes, 0, state.bytes.Length);
         this.absolute = this.absolute || absolute;
     }
 }