[foreign] RFR 8218153: Read/Write of Value layout should honor declared endianness
John Rose
john.r.rose at oracle.com
Wed Feb 27 22:30:36 UTC 2019
On Feb 27, 2019, at 2:25 PM, Henry Jen <henry.jen at oracle.com> wrote:
>
> OK, if we agreed that certainly can be done. :)
>
> Just that, the method doesn’t make sense for other Layout except Value and Group, so they will be no-op.
Also Sequence?
+ protected static Layout withEndianness(Layout layout, Value.Endianness newEndian) {
+ if (layout instanceof Sequence) {
+ return ((Sequence) layout).withEndianness(newEndian);
+ } else if (layout instanceof Group) {
+ return ((Group) layout).withEndianness(newEndian);
+ } else if (layout instanceof Value && ((Value) layout).endianness().isEmpty()) {
+ return ((Value) layout).withEndianness(newEndian);
+ } else {
+ return layout;
+ }
+ }
More information about the panama-dev
mailing list