Unlike with reader source, we won't start from beginning of a file,
but usually from somewhere in the middle...
502519
@Override
    protected void doInitInputLocation(WstxInputData reader)
    {
        reader.mCurrInputProcessed = mContentStart.getCharacterOffset();
        reader.mCurrInputRow = mContentStart.getLineNumber();
        /* 13-Apr-2005, TSa: Since column offsets reported by Location
         *   objects are 1-based, but internally we use 0-based counts,
         *   need to offset this start by 1 to begin with.
         */
        reader.mCurrInputRowStart = -mContentStart.getColumnNumber() + 1;
    }
1010553
private void bufferCentralDirectoryEnd() throws IOException {
        buffer.reset();
        long lengthOfCentral = totalRead - centralOffset;

        int count = processedEntries.size();
        bufferInt(JarEntry.ENDSIG);      // End of central directory signature
        bufferShort(0);                  // Number of this disk
        bufferShort(0);                  // Start of central directory disk
        bufferShort(count);              // Number of processedEntries on disk
        bufferShort(count);              // Total number of processedEntries
        bufferInt(lengthOfCentral);      // Size of central directory
        bufferInt(centralOffset);        // Offset of start of central directory
        bufferShort(0);                  // Comment Length
    }
1056205
function readLastChunk(path, start, end, callback) {
  nodeFs.open(path, "r", function (err, fd) {
    if (err) {
      if (err.code === "EACCES") return callback();
      return callback(err);
    }
    var buffer = new Buffer(4096);
    var length = 0;
    read();
    // Only the first read needs to seek.
    // All subsequent reads will continue from the end of the previous.
    start = null;

    function read() {
      if (buffer.length - length === 0) {
        grow();
      }
      nodeFs.read(fd, buffer, length, buffer.length - length, start, onread);
    }

    function onread(err, bytesRead) {
      if (err) return callback(err);
      length += bytesRead;
      if (bytesRead === 0) {
        return callback(null, buffer.slice(0, buffer.length + end));
      }
      read();
    }

    function grow() {
      var newBuffer = new Buffer(buffer.length * 2);
      buffer.copy(newBuffer);
      buffer = newBuffer;
    }
  });
}
459400
def _start_reader(self):
        
        while True:
            message = yield From(self.pipe.read_message())
            self._process(message)
498000
def source_start(base='', book_id='book'):
    
    repo_htm_path = "{book_id}-h/{book_id}-h.htm".format(book_id=book_id)
    possible_paths = ["book.asciidoc",
                      repo_htm_path,
                      "{}-0.txt".format(book_id),
                      "{}-8.txt".format(book_id),
                      "{}.txt".format(book_id),
                      "{}-pdf.pdf".format(book_id),
                     ]

    # return the first match

    for path in possible_paths:
        fullpath = os.path.join(base, path)
        if os.path.exists(fullpath):
            return path

    return None
305294
protected void skipStatements() throws IOException {
		while (true) {
			st.nextToken();
			if (null != st.sval && st.sval.equalsIgnoreCase("VALUES")) {
				// the next token is the begin of a value
				break;
			}
			if (st.ttype == StreamTokenizer.TT_EOF) {
				// the end of the file is reached
				EOF_reached = true;
				break;
			}
		}
	}
55071
protected boolean moveToRecordStart() throws IOException {
		// The case of split point exactly at whitespace between records, is
		// handled by forcing it to the split following, in the interest of
		// better balancing the splits, by consuming the whitespace in next().
		// The alternative of forcing it to the split preceding, could be
		// done like what is commented here.
		//   while (next != '{' || skipDup > 0) {  // skipDup>0 => record already consumed
		// 	  next = getChar();
		// 	  if (next < 0)  return false;   // end of stream, no good
		// 	  if (next == '}')  skipDup = -1;  // Definitely not
		// 	  else if (skipDup == 0) skipDup = 1;  // no info - Maybe so until refuted by '}'
		//   }

        final int START=0, BRACE=1, TYPE=2, FOUND=3, FAIL=4;
		int next = 0, state = START;
		long resetPosition = readerPosition;
		boolean inEscape = false;
		String fieldName = "";

		while (true) {
			switch(state) {
			case START:
				// scan until we reach a {
				while (next != '{') {
					next = getChar();
					// end of stream, no good
					if (next < 0) {
						return false;
					}
				}

				resetPosition = readerPosition;
				inputReader.mark(100);

				// ok last char was '{', skip till we get to a '"'
				next = getNonWhite();
				if (next < 0) {   // end of stream, no good
					return false;
				}
				if (next == '"') {
					state = BRACE;
				}  // else redo START
				break;

			case BRACE:
				fieldName = "";
				// Next should be a field name of "geometry" or "properties" or "type".

				// If we see another opening brace, the previous one must have been inside
				// a quoted string literal (after which the double quote we found, was a
				// closing quote mark rather than the opening quote mark) - start over.

				while (next != '{') {
					next = getChar();
					if (next < 0) {  // end of stream, no good
						return false;
					}

					inEscape = (!inEscape && next == '\\');
					if (!inEscape && next == '"') {
						break;
					}

					fieldName += (char)next;
				}

				if (fieldName.equals("properties") || fieldName.equals("geometry")) {
					// ok last char was '"', skip till we get to a ':'
					if ((next = getNonWhite()) < 0) {   // end of stream, no good
						return false;
					}
					if (next != ':') {
						state = START;
					} else {
						// and finally, if the next char is a {, we know for sure that this is a valid record
						if ((next = getNonWhite()) < 0) {   // end of stream, no good
							return false;
						}
						state = (next == '{') ? FOUND : START;
					}
				} else if (fieldName.equals("type")) {
					state = TYPE;
				} else {
					// not a field name we were expecting, start over
					state = START;
				}
				break;

			case TYPE:  // expect  :"Feature","
					if ((next = getNonWhite()) < 0) {   // end of stream, no good
						return false;
					}
					if (next != ':') {
						state = START;
					} else {
						if ((next = getNonWhite()) < 0) {   // end of stream, no good
							return false;
						}
						if (next != '"') {
							state = START;
						} else {
							fieldName = "";
							while (true) {
								if ((next = getChar()) < 0)  return false;  // end of stream, no good
								inEscape = (!inEscape && next == '\\');
								if (!inEscape && next == '"')  break;
								fieldName += (char)next;
							}
							if (!"feature".equals(fieldName.toLowerCase())) {
								state = START;
							} else {
								if ((next = getNonWhite()) < 0) {   // end of stream, no good
									return false;
								}
								if (next != ',') {
									state = START;
								} else {
									if ((next = getNonWhite()) < 0) {   // end of stream, no good
										return false;
									}
									state = (next == '"') ? BRACE : START;
								}
							}
						}
					}
				break;

			case FOUND:
				inputReader.reset();
				readerPosition = resetPosition;
				firstBraceConsumed = true;
				return true;

			case FAIL:
				return false;

			default:
				throw new RuntimeException("Internal error");
			}
		}

	}
327356
def beginning_of_line(event):
    "  "
    buff = event.current_buffer
    buff.cursor_position += buff.document.get_start_of_line_position(after_whitespace=False)
361828
private void truncateDestinationFileIfNecessary() {
        RandomAccessFile raf = null;
        if (!FileLocks.lock(dstfile)) {
            throw new FileLockException("Fail to lock " + dstfile);
        }

        try {
            raf = new RandomAccessFile(dstfile, "rw");
            if (lastFullyMergedPartNumber == 0) {
                raf.setLength(0);
            } else {
                long lastByte = ServiceUtils.getLastByteInPart(s3, req, lastFullyMergedPartNumber);
                if (dstfile.length() < lastByte) {
                    throw new SdkClientException(
                        "File " + dstfile.getAbsolutePath() + " has been modified since last pause.");
                }
                raf.setLength(lastByte + 1);
                download.getProgress().updateProgress(lastByte + 1);
            }
        } catch (Exception e) {
            throw new SdkClientException("Unable to append part file to dstfile " + e.getMessage(), e);
        } finally {
            IOUtils.closeQuietly(raf, LOG);
            FileLocks.unlock(dstfile);
        }
    }
627952
private boolean skipOneLine() {
        if (!undecodedChunk.isReadable()) {
            return false;
        }
        byte nextByte = undecodedChunk.readByte();
        if (nextByte == HttpConstants.CR) {
            if (!undecodedChunk.isReadable()) {
                undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1);
                return false;
            }
            nextByte = undecodedChunk.readByte();
            if (nextByte == HttpConstants.LF) {
                return true;
            }
            undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 2);
            return false;
        }
        if (nextByte == HttpConstants.LF) {
            return true;
        }
        undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1);
        return false;
    }
555736
private boolean goToNextStartPosition() throws IOException {
    int basicStartPosition;
    int basicEndPosition;
    if (docId == -1 || docId == NO_MORE_DOCS) {
      throw new IOException("no document");
    } else {
      while ((basicStartPosition = subSpans
          .nextStartPosition()) != NO_MORE_POSITIONS) {
        basicEndPosition = subSpans.endPosition();
        startPosition = Math.max(minPosition,
            (basicStartPosition - query.maximumLeft));
        endPosition = Math.min(maxPosition + 1,
            (basicEndPosition + query.maximumRight));
        if (startPosition <= (basicStartPosition - query.minimumLeft)
            && endPosition >= (basicEndPosition + query.minimumRight)) {
          return true;
        }
      }
      return false;
    }
  }
397605
private void setToRowStart(RowIndexEntry rowEntry, FileDataInput in) throws IOException
    {
        if (in == null)
        {
            this.file = sstable.getFileDataInput(rowEntry.position);
        }
        else
        {
            this.file = in;
            in.seek(rowEntry.position);
        }
        sstable.partitioner.decorateKey(ByteBufferUtil.readWithShortLength(file));
    }
107593
void documentStart() throws SAXException{
        encoding = null;
        standalone = null;
        prefixLength = 0;
        value.setLength(0);
        valueStarted = false;
        entityValue = false;

        elem = elements[0];
        elemLock = elemDepth = 0;
        nsFree = 4;

        systemID = null;
        publicID = null;

        entities.clear();
        entityStack.clear();

        paramEntities.clear();
        paramEntityStack.clear();
        peReferenceOutsideMarkup = false;

        dtd = null;
        _dtd.reset();
        dtdElement = null;
        attributeList = null;
        dtdAttribute = null;

        if(contentHandler!=null){
            contentHandler.setDocumentLocator(this);
            contentHandler.startDocument();
        }
    }
717246
@Override
    public void startOfProcess() {
        String previousBaseIndent = baseIndent.substring(INDENT_LENGTH);
        builder.append(previousBaseIndent).append("HierarchyWrapper{\n");
        processFirstOtherContent = true;
    }
669365
async def _read(self, reader):
        
        start_line = await self._readline(reader)
        self.method, self.location, self.version = start_line.decode().split()
        path_query = urllib.parse.unquote(self.location).split('?', 1)
        self.path = path_query[0]
        self.query = {}
        if len(path_query) > 1:
            for q in path_query[1].split('&'):
                try:
                    k, v = q.split('=', 1)
                    self.query[k] = v
                except ValueError:
                    self.query[q] = None
        self.headers = {}
        while True:
            header_raw = await self._readline(reader)
            if header_raw.strip() == b'':
                break
            header = header_raw.decode().split(':', 1)
            self.headers[header[0]] = header[1].strip()

        # TODO implement chunked handling
        self.data = b''
        await self._buffer_body(reader)
676731
void startFile(String src, PermissionStatus permissions,
                 String holder, String clientMachine,
                 boolean overwrite, boolean createParent, short replication, long blockSize
  ) throws IOException {
    INodeFileUnderConstruction file =
      startFileInternal(src, permissions, holder, clientMachine, overwrite, false,
      createParent, replication, blockSize);
    getEditLog().logSync(false);
    if (auditLog.isInfoEnabled()) {
      logAuditEvent(getCurrentUGI(),
        Server.getRemoteIp(),
        "create", src, null, file);
    }
  }
1032652
private byte[] startNextFile() {
		byte[] ret;
		if (currentSource == softDeviceBytes && bootloaderBytes != null && (type & DfuBaseService.TYPE_BOOTLOADER) > 0) {
			ret = currentSource = bootloaderBytes;
		} else if (currentSource != applicationBytes && applicationBytes != null && (type & DfuBaseService.TYPE_APPLICATION) > 0) {
			ret = currentSource = applicationBytes;
		} else {
			ret = currentSource = null;
		}
		bytesReadFromCurrentSource = 0;
		return ret;
	}