WriteLong() public method

Writes a long as eight bytes.

64-bit unsigned integer written as eight bytes, high-order bytes first.

public WriteLong ( long i ) : void
i long
return void
Ejemplo n.º 1
0
 // pre-order traversal
 private void WriteRecursively(DataOutput @out, TernaryTreeNode node)
 {
     // write out the current node
     @out.WriteString(new string(new char[] { node.splitchar }, 0, 1));
     // prepare a mask of kids
     sbyte mask = 0;
     if (node.eqKid != null)
     {
         mask |= EQ_KID;
     }
     if (node.loKid != null)
     {
         mask |= LO_KID;
     }
     if (node.hiKid != null)
     {
         mask |= HI_KID;
     }
     if (node.token != null)
     {
         mask |= HAS_TOKEN;
     }
     if (node.val != null)
     {
         mask |= HAS_VALUE;
     }
     @out.WriteByte((byte)mask);
     if (node.token != null)
     {
         @out.WriteString(node.token);
     }
     if (node.val != null)
     {
         @out.WriteLong((long)node.val);
     }
     // recurse and write kids
     if (node.loKid != null)
     {
         WriteRecursively(@out, node.loKid);
     }
     if (node.eqKid != null)
     {
         WriteRecursively(@out, node.eqKid);
     }
     if (node.hiKid != null)
     {
         WriteRecursively(@out, node.hiKid);
     }
 }
Ejemplo n.º 2
0
 private void WriteRecursively(DataOutput @out, JaspellTernarySearchTrie.TSTNode node)
 {
     if (node == null)
     {
         return;
     }
     @out.WriteString(new string(new char[] { node.splitchar }, 0, 1));
     sbyte mask = 0;
     if (node.relatives[JaspellTernarySearchTrie.TSTNode.LOKID] != null)
     {
         mask |= LO_KID;
     }
     if (node.relatives[JaspellTernarySearchTrie.TSTNode.EQKID] != null)
     {
         mask |= EQ_KID;
     }
     if (node.relatives[JaspellTernarySearchTrie.TSTNode.HIKID] != null)
     {
         mask |= HI_KID;
     }
     if (node.data != null)
     {
         mask |= HAS_VALUE;
     }
     @out.WriteByte((byte)mask);
     if (node.data != null)
     {
         @out.WriteLong((long)(node.data));
     }
     WriteRecursively(@out, node.relatives[JaspellTernarySearchTrie.TSTNode.LOKID]);
     WriteRecursively(@out, node.relatives[JaspellTernarySearchTrie.TSTNode.EQKID]);
     WriteRecursively(@out, node.relatives[JaspellTernarySearchTrie.TSTNode.HIKID]);
 }