osm4j is a lightweight Java framework for working with OSM data. As a programming library, it offers core interfaces and implementing classes for representing OSM elements and working with data. It supports reading and writing many of the common OSM file formats such as OSM XML and PBF files. Additionally, it can be used to convert OSM elements to instances of the Geometry datatypes from JTS.
osm4j also provides a command line tool based on the core libraries that offers similar (but not as comprehensive) functionality as Osmosis.
The project is organized in several subprojects on GitHub: