@Override public long skip(long n) throws IOException, IllegalArgumentException {
         while (true){
            synchronized (CircularByteBuffer.this){
               if (inputStreamClosed) throw new IOException("InputStream has been closed; cannot skip bytes on a closed InputStream.");
               int available = CircularByteBuffer.this.available();
               if (available > 0){
                  int length = Math.min((int)n, available);
                  int firstLen = Math.min(length, buffer.length - readPosition);
                  int secondLen = length - firstLen;
                  if (secondLen > 0){
                     readPosition = secondLen;
                  } else {
                     readPosition += length;
                  }
                  if (readPosition == buffer.length) {
                     readPosition = 0;
                  }
                  ensureMark();
                  return length;
               } else if (outputStreamClosed){
                  return 0;
               }
            }
            try {
               Thread.sleep(100);
            } catch(Exception x){
               throw new IOException("Blocking read operation interrupted.");
            }
         }
      }