getTokenLen() public static méthode

Get a length token according to the match length.
public static getTokenLen ( int length ) : Token
length int The length here means the number of bytes to be copied.
Résultat Token
Exemple #1
0
        /// <summary>
        /// Add the a match to the result bit buffer.
        /// </summary>
        /// <param name="distance">The number of bytes backward to copy from.</param>
        /// <param name="length">The total number of bytes to be copied.</param>
        private void addCompressBytes(int distance, int length)
        {
            Token token = Config.getTokenDis(distance);

            bitBuffer.AddRange(convertStringToBits(token.BitPrefix));
            bitBuffer.AddRange(convertIntToBits(distance - token.Vbase, token.ValueBits));
            int exp = 1;

            while (length >= Math.Pow(2, exp))
            {
                ++exp;
            }
            token = Config.getTokenLen(length);
            bitBuffer.AddRange(convertStringToBits(token.BitPrefix));
            bitBuffer.AddRange(convertIntToBits(length - (int)Math.Pow(2, exp - 1), token.ValueBits));
        }