Permalink
Browse files

Trim out a couple of inner classes from BufferUtil

  • Loading branch information...
1 parent ec6cf3d commit 71e8d64758e1ba4b321a827296f594e3d92aeef8 Wayne Meissner committed Oct 30, 2008
Showing with 25 additions and 19 deletions.
  1. +1 −0 .hgignore
  2. +24 −19 src/com/kenai/jaffl/util/BufferUtil.java
View
@@ -4,6 +4,7 @@
\.rej$
\.conflict\~$
^target/.*$
+^build/.*$
^nbproject/private/.*$
^lib/.*private.*
^dist/.*
@@ -74,28 +74,33 @@ public final static int indexOf(ByteBuffer buf, byte value) {
private static interface AddressIO {
public long getAddress(ByteBuffer io, int offset);
public void putAddress(ByteBuffer io, int offset, long address);
- public static class Address32Helper {
- public static final AddressIO INSTANCE = new AddressIO() {
- public long getAddress(ByteBuffer io, int offset) {
- return io.getInt(offset);
- }
- public void putAddress(ByteBuffer io, int offset, long address) {
- io.putInt(offset, (int) address);
- }
- };
+ public static class AddressIO32 implements AddressIO {
+
+ public static final AddressIO IMPL = new AddressIO32();
+
+ public long getAddress(ByteBuffer io, int offset) {
+ return io.getInt(offset);
+ }
+
+ public void putAddress(ByteBuffer io, int offset, long address) {
+ io.putInt(offset, (int) address);
+ }
}
- public static class Address64Helper {
- public static final AddressIO INSTANCE = new AddressIO() {
- public long getAddress(ByteBuffer io, int offset) {
- return io.getLong(offset);
- }
- public void putAddress(ByteBuffer io, int offset, long address) {
- io.putLong(offset, address);
- }
- };
+
+ public static class AddressIO64 implements AddressIO {
+
+ public static final AddressIO IMPL = new AddressIO64();
+
+ public long getAddress(ByteBuffer io, int offset) {
+ return io.getLong(offset);
+ }
+
+ public void putAddress(ByteBuffer io, int offset, long address) {
+ io.putLong(offset, address);
+ }
}
public static final AddressIO INSTANCE = Platform.getPlatform().addressSize() == 32
- ? Address32Helper.INSTANCE : Address64Helper.INSTANCE;
+ ? AddressIO32.IMPL : AddressIO64.IMPL;
}
public final static long getAddress(ByteBuffer buf, int position) {

0 comments on commit 71e8d64

Please sign in to comment.