mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-08 22:14:59 +00:00
BytesReference should be a really simple interface, yet it has a gazillion ways to achieve the same this. Methods like `#hasArray`, `#toBytesArray`, `#copyBytesArray` `#toBytesRef` `#bytes` are all really duplicates. This change simplifies the interface dramatically and makes implementations of it much simpler. All array access has been removed and is streamlined through a single `#toBytesRef` method. Utility methods to materialize a compact byte array has been added too for convenience.