This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
MessagePack-Java is a binary serialization library that provides a fast and compact alternative to JSON. The project consists of two main modules:
- msgpack-core: Standalone MessagePack implementation with no external dependencies
- msgpack-jackson: Jackson integration for object mapping capabilities
./sbt compile # Compile source code
./sbt "Test / compile" # Compile source and test code
./sbt package # Create JAR files./sbt test # Run all tests
./sbt ~test # Run tests continuously on file changes
./sbt testOnly *TestClass # Run specific test class
./sbt "testOnly *TestClass -- -z pattern" # Run tests matching pattern
# Test with universal buffer mode (for compatibility testing)
./sbt test -J-Dmsgpack.universal-buffer=true./sbt jcheckStyle # Run checkstyle (Facebook Presto style)
./sbt scalafmtAll # Format all Scala and sbt code./sbt publishLocal # Install to local .ivy2 repository
./sbt publishM2 # Install to local .m2 Maven repositoryThe main entry point is the MessagePack factory class which creates:
- MessagePacker: Serializes objects to MessagePack binary format
- MessageUnpacker: Deserializes MessagePack binary data
Key locations:
- Core interfaces:
msgpack-core/src/main/java/org/msgpack/core/ - Jackson integration:
msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/
MessagePack uses an efficient buffer abstraction layer:
- MessageBuffer: Platform-optimized buffer implementations
- Uses
sun.misc.Unsafefor performance when available - Falls back to ByteBuffer on restricted platforms
- Uses
- MessageBufferInput/Output: Manages buffer sequences for streaming
The msgpack-jackson module provides:
- MessagePackFactory: Jackson JsonFactory implementation
- MessagePackMapper: Pre-configured ObjectMapper for MessagePack
- Support for field IDs (integer keys) for compact serialization
- Extension type support including timestamps
- msgpack-core tests: Written in Scala (always use the latest Scala 3 version) using AirSpec framework
- Location:
msgpack-core/src/test/scala/
- Location:
- msgpack-jackson tests: Written in Java using JUnit
- Location:
msgpack-jackson/src/test/java/
- Location:
For JDK 17+ compatibility, these options are automatically added:
--add-opens=java.base/java.nio=ALL-UNNAMED
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
- Java code follows Facebook Presto style (enforced by checkstyle)
- Scala test code uses Scalafmt with Scala 3 dialect and 100 character line limit
- Checkstyle runs automatically during compilation
- No external dependencies allowed in msgpack-core
- Zero Dependencies: msgpack-core has no external dependencies
- Platform Optimization: Uses platform-specific optimizations when available
- Streaming Support: Both streaming and object-based APIs
- Type Safety: Immutable Value hierarchy for type-safe data handling
- Extension Support: Extensible type system for custom data types