Determining Jordan form from ranks of matrix powers.

Suppose you're working over an algebraically closed field. If $$J$$ is a Jordan matrix, then one can determine the number of Jordan blocks and their sizes for any eigenvalue $$\lambda$$ by looking at the sequence of ranks $$\operatorname{rank}(J-\lambda I)^k$$ for $$k=1,\ldots,m$$ where $$m$$ is the first integer such that $$\operatorname{rank}(J-\lambda I)^m=\operatorname{rank}(J-\lambda I)^{m+1}$$.

I understand how this works for Jordan matrices, but not arbitrary matrices. If you're just given an arbitrary matrix $$A$$, and its set of eigenvalues $$\{\lambda_i\}$$, why does computing $$\operatorname{rank}(A-\lambda_i I)^k$$ for $$k=1,\dots,m$$ also determine the Jordan form for $$A$$, up to the order of blocks? Is there a reason why we may replace $$A$$ with its Jordan form for rank calculations?

Let $$A=T^{-1}JT$$, where $$\det T\ne 0$$, $$A$$ - square matrix, $$J$$ - its Jordan form.
$$\operatorname{rank}((J-\lambda I)^{r}) = \operatorname{rank}(T^{-1}(J-\lambda I)^{r}T) =\operatorname{rank}((A-\lambda I)^{r}),$$
because multiplication of a matrix by non-singular matrix doesn't change the rank. Another way to see this is to interpret rank as a dimension of the image: $$\operatorname{rank}A = \dim\operatorname{Im} A = \dim\operatorname{Im }\left(TAT^{-1}\right)=\dim\operatorname{Im} J =\operatorname{rank}J.$$