WriteByte() public abstract méthode

Writes a single byte.

The most primitive data type is an eight-bit byte. Files are accessed as sequences of bytes. All other data types are defined as sequences of bytes, so file formats are byte-order independent.

public abstract WriteByte ( byte b ) : void
b byte
Résultat void
 // 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);
     }
 }
 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]);
 }