I'm having a problem conceptualising how segmentation works,

BACnet4J seems to segment based on the remote devices maxAPDUlength, and from what I've read, segmentation is managed above the Network layer, so I'm assuming routers do not reassemble and resegment when transmitting onto the next network.

I may be incorrect in either of these assumptions, but if i am not, how would a device, lets say on an IP network, correctly segment for another device on a different IP network, if the two networks are joined by an MSTP network, with routers at the intersections of networks.

How can the device know to segment small enough for the intermediate network if it is smaller than the 2 end networks?

I know that that would be a bad way to set up a network, but as far as i know there is nothing that prevents that in bacnet(unlike multiple paths between networks).

I'm wondering if this is something that bacnet4j does/should handle, and if so how?