Introduction#
MxPack is a modern Java library for reading and writing the MessagePack serialization format.
The Kotlin examples on this website use MxPack's Kotlin integration.
Example#
The following code writes a string and number to path
, then reads them back:
var out = FileChannel.open(path, WRITE, CREATE);
try (var writer = MessageWriter.of(out)) { //
writer.write("Hello, MxPack!"); //
writer.write(42); //
}
var in = FileChannel.open(path);
try (var reader = MessageReader.of(in)) { //
var string = reader.readString(); //
var number = reader.readInt(); //
}
License#
Copyright 2024 the MxPack project authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.