Anglo has it right, with regard to "Balaam's ass" as should be expected from such an astute biblical scholar and Malcolm is correct that "junk" was old sailor slang for salted "preserved" meat.
Some "junk" was so well preserved that sailors used to carve it into sculpture. It had a texture and grain similar to mahogany according to C. Fox Smith and Stan Hugill.