Implement complete Java client for VectorX with JNA bindings and MessagePack support #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements a comprehensive Java client for VectorX that replicates the functionality of the Python client in
LaunchX-Labs/vecx-py. The implementation provides a complete Java interface to the VectorX C++ library with all the same capabilities.🚀 Features Implemented
Core Components
LibVectorX: Main client class providing high-level API for all vector operationsVectorXNative: JNA interface with complete bindings to all native C++ methodsLibraryLoader: Cross-platform native library loading with automatic OS/architecture detectionBufferUtils: Efficient direct buffer management utilities for optimal native performanceMessagePackUtils: Complete MessagePack serialization/deserialization supportVectorXException: Comprehensive error handling with native error codesNative Method Bindings
All native methods from the Python client's
libvx.pyare bound:vecx_create/vecx_destroy- Instance managementvecx_encrypt_vector/vecx_decrypt_vector- Single vector operationsvecx_encrypt_vectors/vecx_decrypt_vectors- Batch operationsvecx_encrypt_meta/vecx_decrypt_meta- Metadata operationsvecx_decrypt_and_calculate_similarities- Optimized similarity searchvecx_calculate_distances- Distance matrix computationvecx_get_error/vecx_get_version- Utility functionsCross-Platform Support
Automatic detection and loading of native libraries for:
vectorx-x64.dll,vectorx-x86.dlllibvectorx-x64.dylib,libvectorx-arm64.dyliblibvectorx-x64.so,libvectorx-arm64.so📋 API Examples
Basic Vector Operations
Metadata Encryption with MessagePack
Batch Operations
Similarity Search
🔧 Technical Implementation
Memory Management
FloatBuffer,ByteBuffer) for efficient native interopAutoCloseablefor automatic resource cleanupError Handling
VectorXExceptionwith native error codesPerformance Optimizations
📦 Maven Configuration
Dependencies:
✅ Testing & Documentation
🎯 Compatibility
This Java client provides identical functionality to the Python client:
The implementation ensures seamless interoperability between Java and Python applications using VectorX.
📁 Project Structure
This implementation provides Java developers with a complete, production-ready client for VectorX operations with the same capabilities as the Python client.
This pull request was created as a result of the following prompt from Copilot chat.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.