@Override
    public long skip(long ns) throws IOException {
      ensureOpen();
      if (next >= length)
        return 0;
      // Bound skip by beginning and end of the source
      long n = Math.min(length - next, ns);
      n = Math.max(-next, n);
      next += n;
      return n;
    }
Check to make sure that the stream has not been closed
ql/src/java/org/apache/hadoop/hive/ql/udf/xml/UDFXPathUtil.java