code: protected int require (int required) throws KryoException {
  		int remaining = limit - position;
  		if (remaining >= required) return remaining;
  		if (required > capacity) throw new KryoException("Buffer too small: capacity: " + capacity + ", required: " + required);
  
  		int count;
  		// Try to fill the buffer.
  		if (remaining > 0) {
  			count = fill(buffer, limit, capacity - limit);
  			if (count == -1) throw new KryoException("Buffer underflow.");
  			remaining += count;
  			if (remaining >= required) {
  				limit += count;
  				return remaining;
  			}
  		}
  
  		// Was not enough, compact and try again.
  		System.arraycopy(buffer, position, buffer, 0, remaining);
  		total += position;
  		position = 0;
  
  		while (true) {
  			count = fill(buffer, remaining, capacity - remaining);
  			if (count == -1) {
  				if (remaining >= required) break;
  				throw new KryoException("Buffer underflow.");
  			}
  			remaining += count;
  			if (remaining >= required) break; // Enough has been read.
  		}
  
  		limit = remaining;
  		return remaining;
  	}
docs: Fills the buffer with at least the number of bytes specified.
  @param required Must be > 0.
  @return The number of bytes remaining in the buffer, which will be at least <code>required</code> bytes.
  @throws KryoException if {@link #fill(byte[], int, int)} is unable to provide more bytes (buffer underflow).