From 4f83f8dd98150bb0179061da4f60e688666aef31 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 17 Oct 2013 14:52:38 -0500 Subject: [PATCH] ByteBuffer: add missing order() methods Avian's ByteBuffer implementation is actually fixed to big endian. So let's throw an exception if the user tries to change that. Signed-off-by: Johannes Schindelin --- classpath/java/nio/ByteBuffer.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/classpath/java/nio/ByteBuffer.java b/classpath/java/nio/ByteBuffer.java index 71c3c7f09a..ee3767f7de 100644 --- a/classpath/java/nio/ByteBuffer.java +++ b/classpath/java/nio/ByteBuffer.java @@ -244,4 +244,13 @@ public abstract class ByteBuffer protected void checkGet(int position, int amount) { if (amount > limit-position) throw new IndexOutOfBoundsException(); } + + public ByteBuffer order(ByteOrder order) { + if (order != ByteOrder.BIG_ENDIAN) throw new UnsupportedOperationException(); + return this; + } + + public ByteOrder order() { + return ByteOrder.BIG_ENDIAN; + } }