Пример #1
0
        public void ReadLine(NativeStringList result)
        {
            var ret = new Result_NSL();

            ret.result = result;
            this.ReadLinesImpl(ret, 1);
        }
Пример #2
0
        public unsafe void ReadLinesFromBuffer(NativeStringList result)
        {
            var ret = new Result_NSL();

            ret.result = result;

            if (_blockPos < _blockNum)
            {
                this.ReadStream();
                fixed(byte *byte_ptr = _byteBuffer)
                {
                    var handle = new GCHandle <Decoder>();

                    handle.Create(_decoder);
                    _worker.DecodeTextIntoBuffer(byte_ptr, _byteLength, handle);
                    handle.Dispose();
                    _worker.GetLines(_lines);
                }
            }

            // read all lines in buffer
            this.PickLinesImpl(ret, int.MaxValue);
            _lines.Clear();

            if (_blockPos == _blockNum)
            {
                // if final part do not have LF.
                if (!_worker.IsEmpty)
                {
                    using (var buff = new NativeList <Char16>(Allocator.Temp))
                    {
                        _worker.GetInternalBuffer(buff);
                        result.Add((char *)buff.GetUnsafePtr(), buff.Length);
                    }
                }
            }
        }