The length of a hydraulic cylinder is the total of the stroke, the thickness of the piston, the thickness of the bottom and head and the length of the connections. Often this length does not fit in the machine. In that case, the piston rod is also used as a piston barrel and a second piston rod is used.
These kinds of hydraulic cylinders are called telescopic cylinders. If we call a normal rod cylinder single stage, telescopic cylinders are multi-stage units of 2, 3, 4, 5 and even 6 stages. In general, telescopic hydraulic cylinders are much more expensive than normal cylinders. Most telescopic cylinders are single-acting (push). Double-acting telescopic cylinders must be specially designed and manufactured.