User is changing of buffer.
357525
def buffer_leave(self, filename):
        """"""
        self.log.debug('buffer_leave: %s', filename)
        # TODO: This is questionable, and we should use location list for
        # single-file errors.
        self.editor.clean_errors()
724064
private void buffer() throws IOException {
        int remaining = buffer.length;
        while (remaining > 0) {
            int r = input.read(buffer, buffer.length - remaining, remaining);
            if (r <= 0) {
                // Not enough information to fill the buffer
                offset = 0;
                maxOffset = buffer.length - remaining;
                return;
            }
            remaining -= r;
        }
        maxOffset = buffer.length;
        offset = 0;
    }
377152
def buffer(self, *args, **kwargs):
        """"""
        self.check_session()
        result = self.session.buffer(*args, **kwargs)
        return result
521493
function _leftShift(buffer) {
        var carry;
        for (var i = buffer.length; i >= 0; i--) {
            carry = (buffer[i] & 0x80) !== 0;
            buffer[i] = (buffer[i] << 1) & 0xFF;
            if (carry && i >= 0) {
                buffer[i + 1] |= 0x01;
            }
        }
    }
573833
function copyBuffer(buf, pos, len) {
  var copy = new Buffer(len);
  buf.copy(copy, 0, pos, pos + len);
  return copy;
}
509761
def buffer_changed
      # display the pattern on the header
      @header.text1(">>>#{@buffer}_") if @header
      @header.text_right(Dir.pwd) if @header
      @no_match = false

      if @command
        @list = @command.call(@buffer)
      else
        @list = @__list.select do |line|
          line.index @buffer
        end
      end
      sz = @list.size
      if sz == 0
        Ncurses.beep
        #return 1
        #this should make ENTER and arrow keys unusable except for BS or Esc, 
        @list = ["No entries"]
        @no_match = true
      end
      data_changed @list
      0
    end
1107553
private void resetEventBuffer() {
        if (buffer.get() == null) {
            buffer.set(new Holder<>(getOrCreateManager().create(charset.get())));
        } else {
            buffer.get().reset();
        }
    }
708511
function (buffer, start, length) {
  /*jshint bitwise:false*/

  var isNested = buffer instanceof ByteBuffer;

  this.buffer = isNested ? buffer.buffer : buffer;
  this.start = (start || 0) + (isNested ? buffer.start : 0);
  this.length = length || (this.buffer.length - this.start);
  this.offset = 0;

}
1347470
def fill_buffer
      while true do
        begin
          new_lines = @file_pointer.read(10485760)
        rescue => e
          return nil
        end
        return nil unless new_lines

        # temp_buf is filled with text split by "\n"
        temp_buf = []
        ss = StringScanner.new(new_lines)
        while ss.scan(/.*?\n/m)             
          temp_buf << ss[0]
        end
        temp_buf << ss.rest unless ss.eos?

        new_first_line = temp_buf.shift
        if new_first_line[-1, 1] == "\n" # new_first_line.index("\n")
          @buffer.last <<  new_first_line
          @buffer << ""
        else
          @buffer.last << new_first_line
        end
        @buffer += temp_buf unless temp_buf.empty?
        if @buffer.last[-1, 1] == "\n" # @buffer.last.index("\n")
          @buffer << ""
        end
        break if @buffer.size > 1
      end
      return true
    end
815397
function (buf) {
    if (!(buf instanceof Buffer) || buf.length !== Id.SIZE)
        throw new Error('invalid buffer');
    this._buf = buf;
}
596191
function BufferSegment(buf, offset, count) {
  if (!Buffer.isBuffer(buf)) throw new TypeError('buf must be a buffer');

  this.buffer = buf;
  this.offset = offset || 0;
  this.count = count || buf.length;
}
1003528
void bufferIt(BufferedOutputStream outStream, int code, int size) throws IOException {
        int PutBuffer = code;
        int PutBits = bufferPutBits;

        PutBuffer &= (1 << size) - 1;
        PutBits += size;
        PutBuffer <<= 24 - PutBits;
        PutBuffer |= bufferPutBuffer;

        while (PutBits >= 8) {
            int c = ((PutBuffer >> 16) & 0xFF);
            outStream.write(c);
            if (c == 0xFF) {
                outStream.write(0);
            }
            PutBuffer <<= 8;
            PutBits -= 8;
        }
        bufferPutBuffer = PutBuffer;
        bufferPutBits = PutBits;

    }
1306454
private int fillFooter(byte []buffer, 
                         int offset, 
                         int entryTail, 
                         boolean isCont)
  {
    BitsUtil.writeInt16(buffer, offset, entryTail);
    offset += 2;

    buffer[offset] = (byte) (isCont ? 1 : 0);
    offset++;
    
    return offset;
  }
226233
function initBufferMode () {
		//how many times output buffer contains input one
		let FOLD = 2;

		//buffer source node
		node = context.createBufferSource()
		node.loop = true;
		node.buffer = util.create(samplesPerFrame * FOLD, channels, {context: node.context})

		//output buffer
		let buffer = node.buffer;

		//audio buffer realtime ticked cycle
		//FIXME: find a way to receive target starving callback here instead of unguaranteed timeouts
		setTimeout(tick)

		node.start()

		//last played count, position from which there is no data filled up
		let lastCount = 0;

		//time of start
		//FIXME: find out why and how this magic coefficient affects buffer scheduling
		let initTime = context.currentTime;

		return node;

		//tick function - if the half-buffer is passed - emit the tick event, which will fill the buffer
		function tick (a) {
			if (isStopped) return;

			let playedTime = context.currentTime - initTime;
			let playedCount = playedTime * sampleRate;

			//if offset has changed - notify processor to provide a new piece of data
			if (lastCount - playedCount < samplesPerFrame) {
				//send queued data chunk to buffer
				util.copy(shift(samplesPerFrame), buffer, lastCount % buffer.length)

				//increase rendered count
				lastCount += samplesPerFrame;

				//if there is a holding pressure control - release it
				if (release) {
					let cb = release;
					release = null;
					cb()
				}

				//call tick extra-time in case if there is a room for buffer
				//it will plan timeout, if none
				tick()
			}
			//else plan tick for the expected time of starving
			else {
				//time of starving is when played time reaches (last count time) - half-duration
				let starvingTime = (lastCount - samplesPerFrame) / sampleRate;
				let remainingTime = starvingTime - playedTime;
				setTimeout(tick, remainingTime * 1000)
			}
		}
	}
328510
private void refreshBuffer() throws IOException {
    if (output == null) {
      // We're writing to a single buffer.
      throw new OutOfSpaceException();
    }

    // Since we have an output stream, this is our buffer
    // and buffer offset == 0
    output.write(buffer, 0, position);
    position = 0;
  }
419168
private boolean putInBuffer(final LoggingEvent event) {
        putInBufferCounter.increment();
        Stopwatch t = putBufferTimeTracer.start();
        boolean hasPut = false;
        if (batcher.process(event)) {
            hasPut = true;
        } else {
            hasPut = false;
        }
        t.stop();
        return hasPut;
    }
791920
protected void reBuffer() {
        resetBuffer();

        try {
            if (bufferOffset >= fs.getFileStatus(inputPath).getLen()) // TODO: is this equivalent?
                return;

            input.seek(bufferOffset);

            int read = 0;

            while (read < buffer.length) {
                int n = input.read(buffer, read, buffer.length - read);
                if (n < 0)
                    break;
                read += n;
            }

            validBufferBytes = read;
            bytesSinceCacheFlush += read;
        } catch (IOException e) {
            throw new FSReadError(e, filePath);
        }
    }