An affine transformation maintains parallel lines as parallel. A perspective transform is by definition does not, and therefore is not affine.
A perspective transfrom is included with the JAI ("Java Advanced Imaging") API but I'm not sure what's the official source for it after Oracle bought Sun.