Finds the beginning of the first <code>encapsulation</code>.

@return <code>true</code> if an <code>encapsulation</code> was found in
the stream.

@throws IOException if an i/o error occurs.
549437
public boolean skipPreamble()
            throws IOException {
        // First delimiter may be not preceeded with a CRLF.
        System.arraycopy(boundary, 2, boundary, 0, boundary.length - 2);
        boundaryLength = boundary.length - 2;
        try {
            // Discard all data up to the delimiter.
            discardBodyData();

            // Read boundary - if succeded, the stream contains an
            // encapsulation.
            return readBoundary();
        } catch (MalformedStreamException e) {
            return false;
        } finally {
            // Restore delimiter.
            System.arraycopy(boundary, 0, boundary, 2, boundary.length - 2);
            boundaryLength = boundary.length;
            boundary[0] = CR;
            boundary[1] = LF;
        }
    }
102901
private boolean extractInitialValue() {
        if (-1 == this.buffIndex) {
            // parsing information not set yet, this should not happen
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Extract: -1 index");
            }
            return false;
        }

        this.bValue = new byte[this.valueLength];
        WsByteBuffer buff = this.myOwner.getParseBuffer(this.buffIndex);
        int savePosition = buff.position();
        // assume all of the data is in the first buffer, and only do the more
        // extensive logic if we need to
        try {
            buff.position(this.offset);
            buff.get(this.bValue, 0, this.valueLength);
            buff.position(savePosition);

        } catch (BufferUnderflowException bue) {
            // no FFDC required
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Header value straddled buffers");
            }
            int lengthNeeded = this.valueLength;
            int arrayOffset = 0;
            // reset the first buffer for the read
            buff.position(this.offset);
            int spaceLeftInBuffer = buff.remaining();
            int index = this.buffIndex + 1;

            // loop until we break out below
            while (true) {
                // reset the position in the buffer for the get() call below
                if (lengthNeeded <= spaceLeftInBuffer) {
                    // get the rest of the data
                    buff.get(this.bValue, arrayOffset, lengthNeeded);
                    buff.position(savePosition);
                    // we're done
                    break;
                }
                // pull out the information from this particular buffer and
                // set it up for querying the next buffer
                buff.get(this.bValue, arrayOffset, spaceLeftInBuffer);
                buff.position(savePosition);
                lengthNeeded -= spaceLeftInBuffer;
                arrayOffset += spaceLeftInBuffer;
                buff = this.myOwner.getParseBuffer(index);
                index++;

                // secondary buffers... save the current position and reset to
                // zero for the next read
                savePosition = buff.position();
                buff.position(0);
                spaceLeftInBuffer = buff.limit();
            } // end of while
        } // end of catch block

        // once we've extracted, fix the length/offset stuff
        this.offset = 0;
        this.buffIndex = -1;
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            this.sValue = GenericUtils.getEnglishString(this.bValue);
            Tr.debug(tc, "extractInitialValue parsed [" + getDebugValue() + "]");
        }
        return true;
    }
1316942
private int findHighStart(int highValue) {

        int value;
        int c, prev;
        int i1, i2, j, i2Block, prevI2Block, block, prevBlock;


        /* set variables for previous range */
        if(highValue==initialValue) {
            prevI2Block=index2NullOffset;
            prevBlock=dataNullOffset;
        } else {
            prevI2Block=-1;
            prevBlock=-1;
        }
        prev=0x110000;

        /* enumerate index-2 blocks */
        i1=UNEWTRIE2_INDEX_1_LENGTH;
        c=prev;
        while(c>0) {
            i2Block=index1[--i1];
            if(i2Block==prevI2Block) {
                /* the index-2 block is the same as the previous one, and filled with highValue */
                c-=UTRIE2_CP_PER_INDEX_1_ENTRY;
                continue;
            }
            prevI2Block=i2Block;
            if(i2Block==index2NullOffset) {
                /* this is the null index-2 block */
                if(highValue!=initialValue) {
                    return c;
                }
                c-=UTRIE2_CP_PER_INDEX_1_ENTRY;
            } else {
                /* enumerate data blocks for one index-2 block */
                for(i2=UTRIE2_INDEX_2_BLOCK_LENGTH; i2>0;) {
                    block=index2[i2Block+ --i2];
                    if(block==prevBlock) {
                        /* the block is the same as the previous one, and filled with highValue */
                        c-=UTRIE2_DATA_BLOCK_LENGTH;
                        continue;
                    }
                    prevBlock=block;
                    if(block==dataNullOffset) {
                        /* this is the null data block */
                        if(highValue!=initialValue) {
                            return c;
                        }
                        c-=UTRIE2_DATA_BLOCK_LENGTH;
                    } else {
                        for(j=UTRIE2_DATA_BLOCK_LENGTH; j>0;) {
                            value=data[block+ --j];
                            if(value!=highValue) {
                                return c;
                            }
                            --c;
                        }
                    }
                }
            }
        }

        /* deliver last range */
        return 0;
    }
583321
public boolean next() throws IOException {
		boolean hasNext = true;
		try {
			oldId = stream.readInt();
			oldText = stream.readUTFAsArray();
		} catch (EOFException e) {
			hasNext = false;
		}
		return hasNext;
	}
466510
private boolean init() throws IOException, CompoundNotFoundException {

		BufferedReader br = new BufferedReader(new FileReader(file));
		br.skip(sequenceStartIndex);
		String sequence = sequenceParser.getSequence(br, sequenceLength);
		setContents(sequence);
		br.close(); // close file to prevent too many being open

		return true;
	}
1100618
public String beginArray() throws IOException {
      String name = null;
      if (currentValue.getKey() == NAME) {
         name = currentValue.getValue().asString();
         consume();
      }
      if (currentValue.getKey() == BEGIN_ARRAY) {
         consume();
      } else if (readStack.peek() != BEGIN_ARRAY) {
         throw new IOException("Expecting BEGIN_ARRAY, but found " + jsonTokenToStructuredElement(null));
      }
      return name;
   }
1047610
private boolean findMatches() throws IOException {
    // check for something in queue of matches
    if (!queueMatches.isEmpty()) {
      return true;
    } else {
      while (true) {
        // try to get something in queue of spans
        if (queueSpans.isEmpty() && !collectSpan()) {
          return false;
        }
        // try to get matches with first span in queue
        Match firstMatch = queueSpans.get(0);
        queueSpans.remove(0);
        // create a list of matches with same startposition as firstMatch
        List<Match> matches = new ArrayList<>();
        matches.add(firstMatch);
        // try to collect spans until lastStartPosition not equal to
        // startposition of firstMatch
        while (!lastSpan && (lastStartPosition == firstMatch.startPosition())) {
          collectSpan();
        }
        while (!queueSpans.isEmpty() && (queueSpans.get(0)
            .startPosition() == firstMatch.startPosition())) {
          matches.add(queueSpans.get(0));
          queueSpans.remove(0);
        }
        // construct all matches for this startposition
        for (Match match : matches) {
          // only unique spans
          if (!queueMatches.contains(match)) {
            queueMatches.add(match);
          }
        }
        // check for something in queue of matches
        if (!queueMatches.isEmpty()) {
          return true;
        }
      }
    }
  }
247154
public boolean masterStarted() {
        if (objectMapper == null)
            objectMapper = new ObjectMapper();

        try {
            String type = objectMapper.readValue(
                            Unirest.get(String.format("http://%s:%d/opType", masterStatusHost, masterStatusPort)).asJson()
                                            .getBody().toString(),
                            ServerTypeJson.class).getType();
            if (!type.equals("master"))
                throw new IllegalStateException("Wrong opType " + type);
            Unirest.get(String.format("http://%s:%d/started", masterStatusHost, masterStatusPort)).asJson().getBody();
            return objectMapper.readValue(
                            Unirest.get(String.format("http://%s:%d/started", masterStatusHost, masterStatusPort))
                                            .asJson().getBody().toString(),
                            MasterStatus.class).started();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
1284475
public static int getStart(String headerLine) throws InvalidObjectException {
        String str = getHeaderInfo("start", headerLine);
        if (str == null) {
            throw new InvalidObjectException("WigFile format, it could not find 'start' in the header line");
        }
        return Integer.parseInt(str);
    }
680955
public Entry getFirst()
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "getFirst");

    if (tc.isEntryEnabled())
      SibTr.exit(tc, "getFirst", first);

    return first;
  }
665460
public T getFirst() {
        Optional<Rsp<T>> retval=values().stream().filter(rsp -> rsp.getValue() != null).findFirst();
        return retval.isPresent()? retval.get().getValue() : null;
    }
1299183
@Override
	public Optional<E> first() {
		try (Stream<E> stream = stream()) {
			return stream.findFirst();
		}
	}
831842
public long readStartCode() throws IOException {
    byte frameCode = in.readByte();
    if (frameCode != 'N') {
      return (long) (frameCode & 0xff);
    }

    // Otherwise read the remaining 64bit startCode
    byte[] buffer = new byte[8];
    buffer[0] = frameCode;
    readFully(buffer, 1, 7);
    return (((long) buffer[0] << 56)
        + ((long) (buffer[1] & 255) << 48)
        + ((long) (buffer[2] & 255) << 40)
        + ((long) (buffer[3] & 255) << 32)
        + ((long) (buffer[4] & 255) << 24)
        + ((buffer[5] & 255) << 16)
        + ((buffer[6] & 255) << 8)
        + ((buffer[7] & 255) << 0));
  }
369543
@Override
  public int nextStartPosition() throws IOException {
    // no document
    if (docId == -1 || docId == NO_MORE_DOCS) {
      throw new IOException("no document");
      // finished
    } else if (noMorePositions) {
      return NO_MORE_POSITIONS;
      // littleSpans already at start match, because of check for matching
      // document
    } else if (!calledNextStartPosition) {
      calledNextStartPosition = true;
      return spans1.spans.startPosition();
      // compute next match
    } else {
      if (goToNextStartPosition()) {
        // match found
        return spans1.spans.startPosition();
      } else {
        // no more matches: document finished
        return NO_MORE_POSITIONS;
      }
    }
  }
1248664
public boolean startsWith(Bytes prefix) {
    Objects.requireNonNull(prefix, "startWith(Bytes prefix) cannot have null parameter");

    if (prefix.length > this.length) {
      return false;
    } else {
      int end = this.offset + prefix.length;
      for (int i = this.offset, j = prefix.offset; i < end; i++, j++) {
        if (this.data[i] != prefix.data[j]) {
          return false;
        }
      }
    }
    return true;
  }
261201
private boolean goToNextStartPosition() throws IOException {
    int nextSpans1StartPosition;
    int nextSpans1EndPosition;
    while ((nextSpans1StartPosition = spans1.spans
        .nextStartPosition()) != NO_MORE_POSITIONS) {
      if (spans1.spans.docID() == spans2.spans.docID()) {
        // clean up
        if (nextSpans1StartPosition > lastSpans2StartPosition) {
          lastSpans2StartPosition = -1;
        }
        // fast check
        if (lastSpans2StartPosition == -1
            && nextSpans1StartPosition < nextSpans2StartPosition) {
          return true;
        }
        nextSpans1EndPosition = spans1.spans.endPosition();
        if (nextSpans1StartPosition == lastSpans2StartPosition) {
          // try to collect all lastSpans2Endpositions, and return true if not
          // contained
          if (collectAndCheckLastSpans(nextSpans1StartPosition,
              nextSpans1EndPosition)) {
            return true;
          } else {
            // continue
          }
        } else {
          // reset, assume lastSpans2StartPosition<nextSpans1StartPosition
          lastSpans2StartPosition = -1;
          // go to correct next
          while (nextSpans2StartPosition < nextSpans1StartPosition) {
            nextSpans2StartPosition = spans2.spans.nextStartPosition();
          }
          nextSpans2EndPosition = spans2.spans.endPosition();
          if (nextSpans1StartPosition == nextSpans2StartPosition) {
            // try to collect all lastSpans2Endpositions, and return true if not
            // contained
            if (collectAndCheckLastSpans(nextSpans1StartPosition,
                nextSpans1EndPosition)) {
              return true;
            } else {
              // continue
            }
          } else {
            return true;
          }
        }
      } else {
        return true;
      }
    }
    // no more positions
    return false;
  }
75946
@Override
  public int nextStartPosition() throws IOException {
    if (currentStartPosition < minPosition) {
      currentStartPosition = minPosition;
      currentEndPosition = currentStartPosition + 1;
    } else {
      currentStartPosition++;
      currentEndPosition = currentStartPosition + 1;
      if (currentStartPosition > maxPosition) {
        currentStartPosition = NO_MORE_POSITIONS;
        currentEndPosition = NO_MORE_POSITIONS;
      }
    }
    return currentStartPosition;
  }