code: protected int optional (int optional) throws KryoException {
  		int remaining = limit - position;
  		if (remaining >= optional) return optional;
  		optional = Math.min(optional, capacity);
  
  		int count;
  
  		// Try to fill the buffer.
  		count = fill(buffer, limit, capacity - limit);
  		if (count == -1) return remaining == 0 ? -1 : Math.min(remaining, optional);
  		remaining += count;
  		if (remaining >= optional) {
  			limit += count;
  			return optional;
  		}
  
  		// 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) break;
  			remaining += count;
  			if (remaining >= optional) break; // Enough has been read.
  		}
  
  		limit = remaining;
  		return remaining == 0 ? -1 : Math.min(remaining, optional);
  	}
docs: Fills the buffer with at least the number of bytes specified, if possible.
  @param optional Must be > 0.
  @return the number of bytes remaining, but not more than optional, or -1 if {@link #fill(byte[], int, int)} is unable to
  provide more bytes.