Lucene.Net.Index.TestPayloads.GenerateRandomData C# (CSharp) Method

GenerateRandomData() private method

private GenerateRandomData ( byte data ) : void
data byte
return void
        private void GenerateRandomData(byte[] data)
        {
            // this test needs the random data to be valid unicode
            string s = TestUtil.RandomFixedByteLengthUnicodeString(Random(), data.Length);
            var b = s.GetBytes(Utf8);
            Debug.Assert(b.Length == data.Length);
            System.Buffer.BlockCopy(b, 0, data, 0, b.Length);
        }

Same methods

TestPayloads::GenerateRandomData ( int n ) : byte[]

Usage Example

Example #1
0
 internal PoolingPayloadTokenStream(TestPayloads outerInstance, ByteArrayPool pool)
 {
     this.OuterInstance = outerInstance;
     this.Pool          = pool;
     Payload            = pool.Get();
     OuterInstance.GenerateRandomData(Payload);
     Term       = Encoding.UTF8.GetString(Payload);
     First      = true;
     PayloadAtt = AddAttribute <IPayloadAttribute>();
     TermAtt    = AddAttribute <ICharTermAttribute>();
 }
All Usage Examples Of Lucene.Net.Index.TestPayloads::GenerateRandomData