[Java] Grow ArrayReadWriteBuf enough to match requested capacity. (#5921)

* [Java] Grow ArrayReadWriteBuf enough to match requested capacity.

Also handle requested capacity overflowing.

* [Java] Improve readability of ArrayReadWriteBuf.requestCapacity()

* [Java] prepare testBuilderGrowth() to fail again once FlexBuffersBuilder uses ByteBufferReadWriteBuf internally, add TestFail() as a better alternative to a plain "assert false"

* [Java] Revert some test changes and extract a small string that was used more than once; one could say three times, however, it might be worthy of a discussion if the third occasion also falls into this category, as it is an independent use case and thus would work in the same way even if the value changed.

Co-authored-by: Markus <markus@greenrobot>
2 files changed
tree: 914789db20db4c66ea7583362d95062d8eca524c
  1. .appveyor/
  2. .bazelci/
  3. .clang-format
  4. .editorconfig
  5. .gitattributes
  6. .github/
  7. .gitignore
  8. .travis.yml
  9. .travis/
  10. BUILD
  11. CMake/
  12. CMakeLists.txt
  13. CONTRIBUTING.md
  14. LICENSE.txt
  15. WORKSPACE
  16. android/
  17. appveyor.yml
  18. build_defs.bzl
  19. composer.json
  20. conan/
  21. conanfile.py
  22. dart/
  23. docs/
  24. go/
  25. grpc/
  26. include/
  27. java/
  28. js/
  29. lobster/
  30. lua/
  31. net/
  32. package.json
  33. php/
  34. pom.xml
  35. python/
  36. readme.md
  37. reflection/
  38. rust/
  39. samples/
  40. snap/
  41. src/
  42. swift/
  43. tests/
readme.md

logo FlatBuffers

Build Status Build status Join the chat at https://gitter.im/google/flatbuffers Discord Chat Twitter Follow

FlatBuffers is a cross platform serialization library architected for maximum memory efficiency. It allows you to directly access serialized data without parsing/unpacking it first, while still having great forwards/backwards compatibility.

Go to our landing page to browse our documentation.

Supported operating systems

  • Windows
  • MacOS X
  • Linux
  • Android
  • And any others with a recent C++ compiler.

Supported programming languages

  • C++
  • C#
  • C
  • Dart
  • Go
  • Java
  • JavaScript
  • Lobster
  • Lua
  • PHP
  • Python
  • Rust
  • TypeScript

and more in progress...

Contribution

To contribute to this project, see CONTRIBUTING.

Licensing

Flatbuffers is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.