io/src/main/java/com/stanfy/enroscar/io/PoolableBufferedInputStream.java
@Override
  public synchronized long skip(final long amount) throws IOException {
    // Use local refs since buf and in may be invalidated by an
    // unsynchronized close()
    final byte[] localBuf = buf;
    final InputStream localIn = in;
    if (localBuf == null) {
      throw new IOException("Stream is closed");
    }
    if (amount < 1) {
      return 0;
    }
    if (localIn == null) {
      throw new IOException("Stream is closed");
    }

    if (count - pos >= amount) {
      pos += amount;
      return amount;
    }
    long read = count - pos;
    pos = count;

    if (markpos != -1 && amount <= marklimit) {
      if (fillbuf(localIn, localBuf) == -1) {
        return read;
      }
      if (count - pos >= amount - read) {
        pos += amount - read;
        return amount;
      }
      // Couldn't get all the bytes, skip what we read
      read += (count - pos);
      pos = count;
      return read;
    }
    return read + localIn.skip(amount - read);
  }
@Override
  public synchronized long skip(final long amount) throws IOException {
    // Use local refs since buf and in may be invalidated by an
    // unsynchronized close()
    final byte[] localBuf = buf;
    final InputStream localIn = in;
    if (localBuf == null) {
      throw new IOException("Stream is closed");
    }
    if (amount < 1) {
      return 0;
    }
    if (localIn == null) {
      throw new IOException("Stream is closed");
    }

    if (count - pos >= amount) {
      pos += amount;
      return amount;
    }
    long read = count - pos;
    pos = count;

    if (markpos != -1 && amount <= marklimit) {
      if (fillbuf(localIn, localBuf) == -1) {
        return read;
      }
      if (count - pos >= amount - read) {
        pos += amount - read;
        return amount;
      }
      // Couldn't get all the bytes, skip what we read
      read += (count - pos);
      pos = count;
      return read;
    }
    return read + localIn.skip(amount - read);
  }
Skips {@code amount} number of bytes in this stream. Subsequent
{@code read()}'s will not return these bytes unless {@code reset()} is
used.

@param amount
the number of bytes to skip. {@code skip} does nothing and
returns 0 if {@code amount} is less than zero.
@return the number of bytes actually skipped.
@throws IOException
if this stream is closed or another IOException occurs.