internal SkipBuffer(IndexInput input, int length)
			{
				data = new byte[length];
				pointer = input.FilePointer;
				input.ReadBytes(data, 0, length);
			}
Ejemplo n.º 2
0
		public void  Read(IndexInput input, FieldInfos fieldInfos)
		{
            this.term = null; // invalidate cache
			int start = input.ReadVInt();
			int length = input.ReadVInt();
			int totalLength = start + length;
			if (preUTF8Strings)
			{
				text.SetLength(totalLength);
				input.ReadChars(text.result, start, length);
			}
			else
			{
				
				if (dirty)
				{
					// Fully convert all bytes since bytes is dirty
					UnicodeUtil.UTF16toUTF8(text.result, 0, text.length, bytes);
					bytes.SetLength(totalLength);
					input.ReadBytes(bytes.result, start, length);
					UnicodeUtil.UTF8toUTF16(bytes.result, 0, totalLength, text);
					dirty = false;
				}
				else
				{
					// Incrementally convert only the UTF8 bytes that are new:
					bytes.SetLength(totalLength);
					input.ReadBytes(bytes.result, start, length);
					UnicodeUtil.UTF8toUTF16(bytes.result, start, length, text);
				}
			}
			this.field = fieldInfos.FieldName(input.ReadVInt());
		}
Ejemplo n.º 3
0
		/// <summary>Copy numBytes bytes from input to ourself. </summary>
		public virtual void  CopyBytes(IndexInput input, long numBytes)
		{
			System.Diagnostics.Debug.Assert(numBytes >= 0, "numBytes=" + numBytes);
			long left = numBytes;
			if (copyBuffer == null)
				copyBuffer = new byte[COPY_BUFFER_SIZE];
			while (left > 0)
			{
				int toCopy;
				if (left > COPY_BUFFER_SIZE)
					toCopy = COPY_BUFFER_SIZE;
				else
					toCopy = (int) left;
				input.ReadBytes(copyBuffer, 0, toCopy);
				WriteBytes(copyBuffer, 0, toCopy);
				left -= toCopy;
			}
		}
Ejemplo n.º 4
0
		/// <summary>Read as a bit set </summary>
		private void  ReadBits(IndexInput input)
		{
			count = input.ReadInt(); // read count
			bits = new byte[(size >> 3) + 1]; // allocate bits
			input.ReadBytes(bits, 0, bits.Length);
		}