The Jataka, Vol. II, tr. by W.H.D. Rouse, , at sacred-texts.com
 "Behold the fruit of sacrifice," etc.--This story the Master told whilst staying in Jetavana, about a believing layman. This was a faithful, pious soul, an elect disciple. One evening, on his way to Jetavana, he came to the hank of the river Aciravatī, when the ferrymen had pulled up their boat on the shore in order to attend service; as no boat could be seen at the landing-stage, and our friend's mind being full of delightful thoughts of the Buddha, he walked into the river 1. His feet did not sink below the water. He got as far as mid-river walking as though he were on dry land; but there he noticed the waves. Then his ecstasy subsided, and his feet began to sink. Again he strung himself up to high tension, and walked on over the water. So he arrived at Jetavana, greeted the Master, and took a seat on one side. The Master entered into conversation with him pleasantly. "I hope, good layman," said he, "you had no mishap on your way." "Oh, Sir," he replied, "on my way I was so absorbed in thoughts of the Buddha that I set foot upon the river; but I walked over it as though it had been dry ground!" "Ah, friend layman," said the Master, "you are not the only one who has kept safe by remembering the virtues of the Buddha. In olden days pious laymen have been shipwrecked in mid-ocean, and saved themselves by remembering the Buddha's virtues." Then, at the man's request, he told an old-world tale.
Once upon a time, in the days when Kassapa was Supreme Buddha, a disciple, who had entered on the Paths, took passage on board ship in company with a barber of some considerable property. The barber's wife had given him in charge of our friend, to look after him in better and in worse.
A week later, the ship was wrecked in mid-ocean. These two persons
clinging to one plank were cast up on an island. There the barber killed some birds, and cooked them, offering a share of his meal to the lay brother. "No, thank you," said he, "I have had enough." He was thinking to himself, "In this place there is no help for us except the Three Jewels 1," and so he pondered upon the blessings of the Three Jewels. As he pondered and pondered, a Serpent-king who had been born in that isle changed his own body to the shape of a great ship. The ship was filled with the seven kinds of precious things.  A Spirit of the Sea was the helmsman. The three masts were made of sapphire, the anchor 2 of gold, the ropes of silver, and the planks were golden.
The Sea-spirit stood on board, crying--"Any passengers for India?" The lay brother said, "Yes, that's where we are bound for." "In with you then--on board with you! "He went aboard, and wanted to call his friend the barber. "You may come," says the helmsman, "but not he." "Why not?" "He is not a man of holy life, that's why," said the other; "I brought this ship for you, not for him." "Very well:--the gifts I have given, the virtues I have practised, the powers I have developed--I give him the fruit of all of them!" "I thank you, master!" said the barber. "Now," said the Sea-spirit, "I can take you aboard." So he conveyed them both oversea, and sailed upstream to Benares. There, by his power, he created a store of wealth for both of them, and bespoke them thus.
"Keep company with the wise and good. If this barber had not been in company with this pious layman, he would have perished in the midst of the deep." Then he uttered these verses in praise of good company:
"Make friendship only with the good, and keep good company;
Friends with the good, this Barber could his home in safety see."
 Thus did the Spirit of the Sea hold forth, poised in mid-air. Finally he went to his own abode, taking the Serpent-king along with him.
The Master, after finishing this discourse, declared the Truths and identified the Birth:--at the conclusion of the Truths the pious layman entered on the Fruit of the Second Path:--"On that occasion the converted lay brother attained Nirvana; Sāriputta was the Serpent-king, and the Sea-spirit was I myself."
77:1 The resemblance to St Peter on the Sea of Galilee is striking.
78:1 The Three Jewels are Buddha, the Law, the Order. For the seven precious things (or jewels), see Childers, p. 402 b.
78:2 lakāro or laṅkūro. I do not know what the word means. Prof. Cowell suggests "anchor," the Mod. Persian for which is langar.