Then two brahman cosmologists went to the Blessed One and, on arrival, exchanged courteous greetings with him. After an exchange of friendly greetings & courtesies, they sat to one side. As they were sitting there, they said to the Blessed One, "Master Gotama, Purana Kassapa — all-knowing, all-seeing — claims exhaustive knowledge & vision: 'Whether I am standing or walking, awake or asleep, continual, unflagging knowledge & vision is established within me.' He says, 'I dwell with infinite knowledge, knowing & seeing the finite cosmos.' Yet Nigantha Nataputta — all-knowing, all-seeing — also claims exhaustive knowledge & vision: 'Whether I am standing or walking, awake or asleep, continual, unflagging knowledge & vision is established within me.' He says, 'I dwell with infinite knowledge, knowing & seeing the infinite cosmos.' Of these two speakers of knowledge, these two who contradict each other, which is telling the truth, and which is lying?"
"Enough, brahmans. Put this question aside. I will teach you the Dhamma. Listen and pay close attention. I will speak."
"Yes, sir," the brahmans responded to the Blessed One, and the Blessed One said, " Suppose that there were four men standing at the four directions, endowed with supreme speed & stride. Like that of a strong archer — well-trained, a practiced hand, a practiced sharp-shooter — shooting a light arrow across the shadow of a palm tree: Such would be the speed with which they were endowed. As far as the east sea is from the west: Such would be the stride with which they were endowed. Then the man standing at the eastern direction would say, 'I, by walking, will reach the end of the cosmos.' He — with a one-hundred year life, a one-hundred year span — would spend one hundred years traveling — apart from the time spent on eating, drinking, chewing & tasting, urinating & defecating, and sleeping to fight off weariness — but without reaching the end of the cosmos he would die along the way. [Similarly with the men standing at the western, southern, & northern directions.] Why is that? I tell you, it isn't through that sort of traveling that the end of the cosmos is known, seen, or reached. But at the same time, I tell you that there is no making an end of suffering & stress without reaching the end of the cosmos.
"These five strings of sensuality are, in the discipline of the noble ones, called the cosmos. Which five? Forms cognizable via the eye — agreeable, pleasing, charming, endearing, fostering desire, enticing; sounds cognizable via the ear... aromas cognizable via the nose... flavors cognizable via the tongue... tactile sensations cognizable via the body — agreeable, pleasing, charming, endearing, fostering desire, enticing. These are the five strings of sensuality that, in the discipline of the noble ones, are called the cosmos.
"There is the case where a monk — quite secluded from sensuality, secluded from unskillful qualities — enters & remains in the first jhāna: rapture & pleasure born of seclusion, accompanied by directed thought & evaluation. This is called a monk who, coming to the end of the cosmos, remains at the end of the cosmos. Others say of him, 'He is encompassed in the cosmos; he has not escaped from the cosmos.' And I too say of him, 'He is encompassed in the cosmos; he has not escaped from the cosmos.'
[Similarly with the second, third, & fourth jhānas, and with the attainment of the dimensions of the infinitude of space, the infinitude of consciousness, nothingness, and neither perception nor non-perception.]
"Furthermore, with the complete transcending of the dimension of neither perception nor non-perception, he enters & remains in the cessation of perception & feeling. And, having seen [that] with discernment, his fermentations are completely ended. This is called a monk who, coming to the end of the cosmos, remains at the end of the cosmos, having crossed over attachment in the cosmos."
See also: AN 4.45