Get circular buffer location where current data is being written.
173259
def current_pos(self):
        """"""
        new_ptr = _decode(
            self._read_fixed_block(0x0020), self.lo_fix_format['current_pos'])
        if new_ptr == self._current_ptr:
            return self._current_ptr
        if self._current_ptr and new_ptr != self.inc_ptr(self._current_ptr):
            logger.error(
                'unexpected ptr change %06x -> %06x', self._current_ptr, new_ptr)
        self._current_ptr = new_ptr
        return self._current_ptr
1310331
def get_overlay_data_start_offset(self):
        """"""

        largest_offset_and_size = (0, 0)

        def update_if_sum_is_larger_and_within_file(offset_and_size, file_size=len(self.__data__)):
            if sum(offset_and_size) <= file_size and sum(offset_and_size) > sum(largest_offset_and_size):
                return offset_and_size
            return largest_offset_and_size

        if hasattr(self, 'OPTIONAL_HEADER'):
            largest_offset_and_size = update_if_sum_is_larger_and_within_file(
                (self.OPTIONAL_HEADER.get_file_offset(), self.FILE_HEADER.SizeOfOptionalHeader))

        for section in self.sections:
            largest_offset_and_size = update_if_sum_is_larger_and_within_file(
                (section.PointerToRawData, section.SizeOfRawData))

        skip_directories = [DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_SECURITY']]

        for idx, directory in enumerate(self.OPTIONAL_HEADER.DATA_DIRECTORY):
            if idx in skip_directories:
                continue
            try:
                largest_offset_and_size = update_if_sum_is_larger_and_within_file(
                    (self.get_offset_from_rva(directory.VirtualAddress), directory.Size))
            # Ignore directories with RVA out of file
            except PEFormatError:
                continue

        if len(self.__data__) > sum(largest_offset_and_size):
            return sum(largest_offset_and_size)

        return None
461944
int findNextUsedLinePos(int pos) {

        try {
            int     firstPos   = pos;
            int     currentPos = pos;
            boolean wasCR      = false;

            dataFile.seek(pos);

            while (true) {
                int c = dataFile.read();

                currentPos++;

                switch (c) {

                    case CR_CHAR :
                        wasCR = true;
                        break;

                    case LF_CHAR :
                        wasCR = false;

                        ((RowInputText) rowIn).skippedLine();

                        firstPos = currentPos;
                        break;

                    case ' ' :
                        if (wasCR) {
                            wasCR = false;

                            ((RowInputText) rowIn).skippedLine();
                        }
                        break;

                    case -1 :
                        return -1;

                    default :
                        return firstPos;
                }
            }
        } catch (IOException e) {
            throw new HsqlException(e.getMessage(), "", 0);
        }
    }
175813
private int writeAtMost(byte[] data, int offset, int length)
    {
        if (current >= bufferOffset + buffer.length)
            reBuffer();

        assert current < bufferOffset + buffer.length
                : String.format("File (%s) offset %d, buffer offset %d.", getPath(), current, bufferOffset);


        int toCopy = Math.min(length, buffer.length - bufferCursor());

        // copy bytes from external buffer
        System.arraycopy(data, offset, buffer, bufferCursor(), toCopy);

        assert current <= bufferOffset + buffer.length
                : String.format("File (%s) offset %d, buffer offset %d.", getPath(), current, bufferOffset);

        validBufferBytes = Math.max(validBufferBytes, bufferCursor() + toCopy);
        current += toCopy;

        return toCopy;
    }
939198
def location(self):
        
        if self._location is None:
            self._location = "{}/{}-{}".format(
                self.stream,
                self.type,
                self.sequence,
            )
        return self._location
873591
def prev_cursor_location(self):
        
        self._verify_entrypoint_selected()
        self.current_trace_frame_index = max(self.current_trace_frame_index - 1, 0)
        self.trace()
950102
def _getPaddingDataToSectionOffset(self):
        
        start = self._getPaddingToSectionOffset()
        end = self.sectionHeaders[0].pointerToRawData.value - start
        return self._data[start:start+end]
725472
def buffer(self):
        '''
        
        '''
        return buffer(self._input, self._start_pos,
                      (self._end_pos - self._start_pos))
559011
def data_received(self, data):
        """"""
        data = data.decode()
        log.debug('received data: %s', data.strip())
        self.buffer += data
        self.handle_lines()
532854
public void writeIntCurrentPosition(int v) throws IOException {
    int index = (int)(position - bufferOffset);
    if (index < maxBufferSize) {
      buffer[index] = v;
      isByte[index] = false;
      if (index + 1 > currentBufferSize) currentBufferSize = index + 1;
      if (index + 1 >= maxBufferSize) {
        writeBuffer();
        newBuffer(position + 1);
      }
    } else {
      aFile.write(v);
    }
    position++;
  }
837017
def _findbytes(self, bytes_, start, end, bytealigned):
        
        assert self._datastore.offset == 0
        assert bytealigned is True
        # Extract data bytes from bitstring to be found.
        bytepos = (start + 7) // 8
        found = False
        p = bytepos
        finalpos = end // 8
        increment = max(1024, len(bytes_) * 10)
        buffersize = increment + len(bytes_)
        while p < finalpos:
            # Read in file or from memory in overlapping chunks and search the chunks.
            buf = bytearray(self._datastore.getbyteslice(p, min(p + buffersize, finalpos)))
            pos = buf.find(bytes_)
            if pos != -1:
                found = True
                p += pos
                break
            p += increment
        if not found:
            return ()
        return (p * 8,)
93202
@Override
    public WsByteBuffer getRemainingData() {

        if (!isReadDataAvailable()) {
            return null;
        }

        WsByteBuffer retBuf = null;

        int position = getReadBuffer().position();
        int limit = getReadBuffer().limit();

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Current body buffer " + getReadBuffer());
        }

        if (0 == position && limit == getReadBuffer().capacity()) {
            // this is a full buff we can return
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Return a full buffer");
            }
            retBuf = returnLastBuffer();

        } else {
            // slice up a return
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Slice the return buffer");
            }
            // slice from the position set above
            retBuf = getReadBuffer().slice();

        }

        return retBuf;

    }
344523
def data(self):
        ''''''
        # return data after any initial offset, plus content offset to
        # skip header, up to the size of this message
        return self.mmap[self.content_offset + self._offset: self._offset + self.size]
564811
bbBlock findBlockForWrite(Object caller, int version, bbBlock curr, int pos)
    {
        assert mutation_in_progress(caller, version);
        assert (pos >= 0 && "invalid position, positions must be >= 0".length() > 0);
        if (pos > this._buf_limit + 1) {
            throw new BlockedBufferException("writes must be contiguous");
        }
        assert _validate();
        if (curr != null && curr.hasRoomToWrite(pos, 1) == true) {
            if (curr._offset + curr._limit == pos && curr._idx < this._next_block_position) {
                bbBlock b = this._blocks.get(curr._idx + 1);
                if (b.containsForWrite(pos)) {
                    curr = b;
                }
            }
            return curr;
        }
        // we're not going to write into curr, so find out the right block
        bbBlock block;
        if (pos == this._buf_limit) {
            // if we're at the limit the only possible (existing) block
            // will be the very last block - shortcut to optimize append
            assert this._next_block_position > 0;
            block = this._blocks.get(this._next_block_position - 1);
        }
        else if (curr != null && pos == curr._offset + curr._limit) {
            // if our current position is exactly at the end (and we already know
            // we can't write into this block if we can write at all we'll have
            // to write into the next block (inner blocks can't be 0 bytes long)
            block = this._blocks.get(curr._idx + 1);
        }
        else {
            // since we're not at the limit and we don't have a current block
            // we'll go find the block in the list (this is an abnormal case)
            // since append if usual for writing
            block = findBlockHelper(pos, 0, this._next_block_position);
        }
        assert block != null;
        assert block.containsForWrite(pos);
        // chech our candidate block to see if it's the one we'd write into
        if (block.hasRoomToWrite(pos, 1)) {
            return block;
        }
        // at this point, we can't use _curr in any event so we can just
        // move on to the next block since findHelper will have returned
        // either the right block (which it didn't) or the one just in
        // front of the right block - so let's see if there is an allocated
        // block just following this
        if (block._idx < this._next_block_position - 1) {
            block = this._blocks.get(block._idx + 1);
            return block;
        }
        // there wasn't a following block (actually a common case when
        // you're appending) so we have to go ahead an actually add a new block
        int newIdx = block._idx + 1;
        assert newIdx == this._next_block_position;
        bbBlock ret =  this.addBlock(caller
                            ,version
                            ,newIdx
                            ,pos
                            ,this.nextBlockSize(caller, version)
               );
        return ret;
    }
779635
function getOrientation(buffer){
    var view = new DataView(buffer);
    if (view.getUint16(0, false) != 0xFFD8) return -2;
    var length = view.byteLength, offset = 2;
    while (offset < length) {
        var marker = view.getUint16(offset, false);
        offset += 2;
        if (marker == 0xFFE1) {
            if (view.getUint32(offset += 2, false) != 0x45786966) return -1;
            var little = view.getUint16(offset += 6, false) == 0x4949;
            offset += view.getUint32(offset + 4, little);
            var tags = view.getUint16(offset, little);
            offset += 2;
            for (var i = 0; i < tags; i++)
                if (view.getUint16(offset + (i * 12), little) == 0x0112)
                    return view.getUint16(offset + (i * 12) + 8, little);
        }
        else if ((marker & 0xFF00) != 0xFF00) break;
        else offset += view.getUint16(offset, false);
    }
    return -1;
}
1178627
def position(self):
        """"""
        line, col = self._position(self.chunkOffset)
        return (line + 1, col)
905080
def get_current_line(self):
        """"""
        if not self.has_space():
            return None

        pos = self.pos - self.col
        string = self.string
        end = self.length

        output = []
        while pos < len(string) and string[pos] != '\n':
            output.append(string[pos])
            pos += 1
            if pos == end:
                break
        else:
            output.append(string[pos])

        if not output:
            return None

        return SourceLine(''.join(output), self.row)