[FlexBuffers][Java] Implementation of FlexBuffers API (#5476)
authorPaulo Pinheiro <paulovictor.pinheiro@gmail.com>
Thu, 29 Aug 2019 22:06:24 +0000 (00:06 +0200)
committerWouter van Oortmerssen <aardappel@gmail.com>
Thu, 29 Aug 2019 22:06:24 +0000 (15:06 -0700)
commit8e6cabb31be63e28bac325cfcf5cbaa443d2cf7d
tree26bb247278c2c83361e43da6c1776b3816018201
parentbd31dd2425fecc5d0b10f3bf4be8c84635fb63ba
[FlexBuffers][Java] Implementation of FlexBuffers API (#5476)

* [FlexBuffers][Java] Implementation of FlexBuffers API

This is the initial attemp to implement FlexBuffer on Java.

There is some limitations as compared to the C++ implementation:
  1 - No mutations implemented yet
  2 - Does not parse from json

Also, this initial implementation is not focused and performance, but
get the basics write. So there is many opportunities for optimization, for instance,
remove all enums, return CharSequence instead of Strings and object pooling.

* [FlexBuffers][Java] Optimizations and simplification of the Builder  API.

This change removes BitWidth enum in favor of static ints. Also
make all "reads" APIs closer to C++ implementation (try to cast or convert
as much as possible, assuming user knows what he is doing). Finally,
we remove the helper classes for building vectors and maps.

There is no official benchmarks, but the unit tests are running in less
than 50% for previous runs, which mean those optimizations are worth it.

* [FlexBuffers][Java] Fix Reference::asString behavior

There was a incorrect assumption that strings would be null-terminated, which
could lead to truncated strings. S now it relies size instead of null-termination.

Other minor improvements
java/com/google/flatbuffers/FlexBuffers.java [new file with mode: 0644]
java/com/google/flatbuffers/FlexBuffersBuilder.java [new file with mode: 0644]
tests/JavaTest.java
tests/JavaTest.sh