+ /**
+ * Check if we need to stop the {@link InputStream} reading at some point in
+ * the current buffer.
+ * <p>
+ * If we do, return the index at which to stop; if not, return -1.
+ * <p>
+ * This method will <b>not</b> return the same index a second time (unless
+ * we cleared the buffer).
+ *
+ * @param buffer
+ * the buffer to check
+ * @param pos
+ * the current position of what was read in the buffer
+ * @param len
+ * the maximum index to use in the buffer (anything above that is
+ * not to be used)
+ *
+ * @return the index at which to stop, or -1
+ */