{"id":15180572,"url":"https://github.com/juku/vertx-binary-serialization","last_synced_at":"2026-01-29T17:31:03.918Z","repository":{"id":57725708,"uuid":"150429967","full_name":"JuKu/vertx-binary-serialization","owner":"JuKu","description":"A simple binary serialization method for vertx which uses annotations \u0026 reflection like spring jpa / hibernate for databases.","archived":false,"fork":false,"pushed_at":"2018-12-22T17:51:07.000Z","size":224,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-24T11:14:00.088Z","etag":null,"topics":["java","java10","java8","network","networking","serialization","vertx"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JuKu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-26T13:20:38.000Z","updated_at":"2019-02-21T03:44:09.000Z","dependencies_parsed_at":"2022-09-02T03:31:03.189Z","dependency_job_id":null,"html_url":"https://github.com/JuKu/vertx-binary-serialization","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuKu%2Fvertx-binary-serialization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuKu%2Fvertx-binary-serialization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuKu%2Fvertx-binary-serialization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuKu%2Fvertx-binary-serialization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JuKu","download_url":"https://codeload.github.com/JuKu/vertx-binary-serialization/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240466797,"owners_count":19805862,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","java10","java8","network","networking","serialization","vertx"],"created_at":"2024-09-27T16:22:57.975Z","updated_at":"2026-01-29T17:31:03.886Z","avatar_url":"https://github.com/JuKu.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vertx-binary-serialization\n\nA simple binary serialization method for vertx which uses annotations \u0026amp; reflection like spring jpa for databases.\n\n[![Build Status](https://travis-ci.org/JuKu/vertx-binary-serialization.svg?branch=master)](https://travis-ci.org/JuKu/vertx-binary-serialization)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=com.jukusoft%3Avertx-binary-serializer-parent\u0026metric=ncloc)](https://sonarcloud.io/dashboard/index/com.jukusoft%3Avertx-binary-serializer-parent) \n[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=com.jukusoft%3Avertx-binary-serializer-parent\u0026metric=alert_status)](https://sonarcloud.io/dashboard/index/com.jukusoft%3Avertx-binary-serializer-parent) \n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=com.jukusoft%3Avertx-binary-serializer-parent\u0026metric=coverage)](https://sonarcloud.io/dashboard/index/com.jukusoft%3Avertx-binary-serializer-parent) \n[![Technical Debt Rating](https://sonarcloud.io/api/project_badges/measure?project=com.jukusoft%3Avertx-binary-serializer-parent\u0026metric=sqale_index)](https://sonarcloud.io/dashboard/index/com.jukusoft%3Avertx-binary-serializer-parent) \n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=com.jukusoft%3Avertx-binary-serializer-parent\u0026metric=code_smells)](https://sonarcloud.io/dashboard/index/com.jukusoft%3Avertx-binary-serializer-parent) \n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=com.jukusoft%3Avertx-binary-serializer-parent\u0026metric=bugs)](https://sonarcloud.io/dashboard/index/com.jukusoft%3Avertx-binary-serializer-parent) \n[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=com.jukusoft%3Avertx-binary-serializer-parent\u0026metric=vulnerabilities)](https://sonarcloud.io/dashboard/index/com.jukusoft%3Avertx-binary-serializer-parent) \n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=com.jukusoft%3Avertx-binary-serializer-parent\u0026metric=security_rating)](https://sonarcloud.io/dashboard/index/com.jukusoft%3Avertx-binary-serializer-parent) \n\n[![Sonarcloud](https://sonarcloud.io/api/project_badges/quality_gate?project=com.jukusoft%3Avertx-binary-serializer-parent)](https://sonarcloud.io/dashboard?id=com.jukusoft%3Avertx-binary-serializer-parent)\n\n## Requirements\n\n  - Java 8+\n  - [vert.x](http://vertx.io)\n  \n## Maven Coordinates\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.jukusoft/vertx-binary-serializer.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.jukusoft%22%20AND%20a:%22vertx-binary-serializer%22)\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.jukusoft\u003c/groupId\u003e\n  \u003cartifactId\u003evertx-binary-serializer\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.8\u003c/version\u003e\n\u003c/dependency\u003e\n\n\u003c!-- If you want to use TCPServer and TCPClient, you need also this dependency --\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.jukusoft\u003c/groupId\u003e\n  \u003cartifactId\u003evertx-binary-serializer-connection\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.8\u003c/version\u003e\n\u003c/dependency\u003e\n```\n  \n## HowTo\n\nFirst create some message objects which contains some datatypes:\n```java\n@MessageType(type = 0x01)\n@ProtocolVersion(1)\npublic class Message implements SerializableObject {\n\n    @SInteger\n    public int test = 0;\n\n}\n\n@MessageType(type = 0x02)\n@ProtocolVersion(2)\npublic class SecondMessage implements SerializableObject {\n    \n    @SFloat\n    public float a = 0f;\n\n    @SString\n    public String myString = null;\n\n}\n```\n\nYou have to add the annotations `MessageType` with the type (1 byte as type, 1 byte as extended type) and `ProtocolVersion` to check, if Serializer on other side can unserialize this object.\n\nThen you can serialize and unserialize this object easely:\n```java\n//first, register this new message types\nTypeLookup.register(Message.class);\nTypeLookup.register(SecondMessage.class);\n\n//create message object which implements SerializableObject\nMessage msg = new Message();\nmsg.test = 20;\n\nSecondMessage msg1 = new SecondMessage();\nmsg1.a = 0.2f;\nmsg1.myString = \"my-new-string\";\n\n//serialize object into byte buffer\nBuffer buffer = Serializer.serialize(msg);\n\n//unserialize object from byte buffer\nMessage obj1 = Serializer.unserialize(buffer);\n\n//get value\nSystem.out.println(\"test value: \" + obj1.test);\n\n//second message\n\n//serialize object into byte buffer\nBuffer buffer = Serializer.serialize(msg1);\n\n//unserialize object from byte buffer\nSecondMessage obj2 = Serializer.unserialize(buffer);\n\n//get value(s)\nSystem.out.println(\"float value: \" + obj2.a);\nSystem.out.println(\"string value: \" + obj2.myString);\n```\n\n**NOTICE**: `public` variables aren't required, they can also be `private` or `protected` instead.\nBut to avoid getters \u0026 setters here, we have accessed them directly in this example.\n\n## Protocol Header\n\nBefore adding the payload to buffer, there is adding a header with these fields:\n  - maybe: 4x byte (integer) **length of message** (so it can check, if full message was received or we have to wait for other traffic)\n  - 1x byte **type**\n  - 1x byte **extended byte** (so you can use 65,536 different types, instead of 256 bytes)\n  - 2x byte **version** (to check compatibility)\n  - after that: **payload data**\n\n## Supported datatypes\n\nAll primitive datatypes in Java are supported:\n\n  - byte (`@SByte`)\n  - short (`@SShort`)\n  - int (`@SInteger`)\n  - long (`@SLong`)\n  - float (`@SFloat`)\n  - double (`@SDouble`)\n  - boolean (`@SBoolean`)\n  - char (`@SChar`)\n  - Vertx. Buffer (`@SBuffer`)\n  - byte array (max 4.294.967.296 bytes in an array, `@SBytes`)\n  - json object \u0026 json array (`@SJsonObject` and `@SJsonArray`)\n  \n**Complex datatypes** (objects) are **not** supported!\n\n## Run Sonarcloud\n\n```bash\nclean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=jukusoft -Dsonar.login=\u003cSonar-Token\u003e\n```\n\n## Support\n\nIf you have questions, found a bug or have a feature request:\\\nPlease **open an [issue](https://github.com/JuKu/vertx-binary-serialization/issues)**! I try to answer as fast as possible.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuku%2Fvertx-binary-serialization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuku%2Fvertx-binary-serialization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuku%2Fvertx-binary-serialization/lists"}