/// <summary> /// Copy the current contents of this buffer to the named output. </summary> public virtual void WriteTo(DataOutput @out) { Flush(); long end = file.length; long pos = 0; int buffer = 0; while (pos < end) { int length = BUFFER_SIZE; long nextPos = pos + length; if (nextPos > end) // at the last buffer { length = (int)(end - pos); } @out.WriteBytes(file.GetBuffer(buffer++), length); pos = nextPos; } }
/// <summary> /// Copy the current contents of this buffer to the named output. </summary> public virtual void WriteTo(DataOutput @out) { Flush(); long end = File.Length_Renamed; long pos = 0; int buffer = 0; while (pos < end) { int length = BUFFER_SIZE; long nextPos = pos + length; if (nextPos > end) // at the last buffer { length = (int)(end - pos); } @out.WriteBytes(File.GetBuffer(buffer++), length); pos = nextPos; } }
public override void EncodeTerm(long[] empty, DataOutput output, FieldInfo fieldInfo, BlockTermState _state, bool absolute) { PulsingTermState state = (PulsingTermState) _state; Debug.Debug.Assert((empty.Length == 0); this.absolute = this.absolute || absolute; if (state.bytes == null) { _wrappedPostingsWriter.EncodeTerm(longs, buffer, fieldInfo, state.wrappedState, this.absolute); for (int i = 0; i < longsSize; i++) { output.WriteVLong(longs[i]); } buffer.WriteTo(output); buffer.Reset(); this.absolute = false; } else { output.WriteVInt(state.bytes.Length); output.WriteBytes(state.bytes, 0, state.bytes.Length); this.absolute = this.absolute || absolute; } }