I need to draw a line using java.awt.Graphics, but only the portion of the line that lies outside of a rectangle should be rendered.

Is it possible to use the Graphics clipping support or do I need to calculate the intersection and clip the line myself?