@Override
	public long skip(long n) throws IOException {
		// Skip in the queue
		synchronized(file) {
			while(true) {
				long fileLen=file.getLength();
				if(fileLen>=1) {
					long pos=file.getFirstIndex();
					long skipSize=fileLen>n?n:fileLen;
					// When at the end of the file, skip the remaining bytes
					if((pos+skipSize)>file.maxFifoLength) skipSize=file.maxFifoLength-pos;

					// Skip as many bytes as currently available
					long totalSkipped=skipSize;
					long newFirstIndex=pos+skipSize;
					while(newFirstIndex>=file.maxFifoLength) newFirstIndex-=file.maxFifoLength;
					file.setFirstIndex(newFirstIndex);
					file.setLength(fileLen-skipSize);
					file.notify();
					return totalSkipped;
				}
				try {
					file.wait();
				} catch(InterruptedException err) {
					InterruptedIOException ioErr=new InterruptedIOException();
					ioErr.initCause(err);
					throw ioErr;
				}
			}
		}
	}
@ Override public long skip ( long n ) throws IOException { synchronized ( file ) { while ( true ) { long fileLen = file . getLength ( ) ; if ( fileLen >= 1 ) { long pos = file . getFirstIndex ( ) ; long skipSize = fileLen > n ? n : fileLen ; if ( ( pos + skipSize ) > file . maxFifoLength ) skipSize = file . maxFifoLength - pos ; long totalSkipped = skipSize ; long newFirstIndex = pos + skipSize ; while ( newFirstIndex >= file . maxFifoLength ) newFirstIndex -= file . maxFifoLength ; file . setFirstIndex ( newFirstIndex ) ; file . setLength ( fileLen - skipSize ) ; file . notify ( ) ; return totalSkipped ; } try { file . wait ( ) ; } catch ( InterruptedException err ) { InterruptedIOException ioErr = new InterruptedIOException ( ) ; ioErr . initCause ( err ) ; throw ioErr ; } } } }
Skips data in the queue, blocks until at least one byte is skipped.