protected void ensureAvailableBytes(int amount) throws IOException {
		if (!this.seekEnabled && amount > this.buffer.remaining()) {
			this.bufferPosition += this.buffer.position();
			this.buffer.compact();
			int limit = this.buffer.position();
			final int read = this.stream.read(this.buffer);
			if (read < 0) {
				if (limit == 0) {
					throw new EOFException();
				}
			} else {
				limit += read;
			}
			this.buffer.rewind();
			this.buffer.limit(limit);

		}
		if (amount > this.buffer.remaining()) {
			throw new EOFException();
		}
	}
protected void ensureAvailableBytes ( int amount ) throws IOException { if ( ! this . seekEnabled && amount > this . buffer . remaining ( ) ) { this . bufferPosition += this . buffer . position ( ) ; this . buffer . compact ( ) ; int limit = this . buffer . position ( ) ; final int read = this . stream . read ( this . buffer ) ; if ( read < 0 ) { if ( limit == 0 ) { throw new EOFException ( ) ; } } else { limit += read ; } this . buffer . rewind ( ) ; this . buffer . limit ( limit ) ; } if ( amount > this . buffer . remaining ( ) ) { throw new EOFException ( ) ; } }
Ensure that the reading buffer is containing enoug bytes to read.

@param amount is the count of expected bytes
@throws IOException in case of error.