Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 6 additions & 28 deletions jme3-core/src/main/java/com/jme3/util/BufferUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1277,36 +1277,14 @@ public static void destroyDirectBuffer(Buffer toBeDestroyed) {
allocator.destroyDirectBuffer(toBeDestroyed);
}

/*
* FIXME when java 1.5 supprt is dropped - replace calls to this method with
* Buffer.isDirect
*
* Buffer.isDirect() is only java 6. Java 5 only have this method on Buffer
* subclasses : FloatBuffer, IntBuffer, ShortBuffer,
* ByteBuffer,DoubleBuffer, LongBuffer. CharBuffer has been excluded as we
* don't use it.
*
/**
* Test whether the specified buffer is direct.
*
* @param buf the buffer to test (not null, unaffected)
* @return true if direct, otherwise false
*/
private static boolean isDirect(Buffer buf) {
if (buf instanceof FloatBuffer) {
return buf.isDirect();
}
if (buf instanceof IntBuffer) {
return buf.isDirect();
}
if (buf instanceof ShortBuffer) {
return buf.isDirect();
}
if (buf instanceof ByteBuffer) {
return buf.isDirect();
}
if (buf instanceof DoubleBuffer) {
return buf.isDirect();
}
if (buf instanceof LongBuffer) {
return buf.isDirect();
}
throw new UnsupportedOperationException(" BufferUtils.isDirect was called on " + buf.getClass().getName());
return buf.isDirect();
}

private static class BufferInfo extends PhantomReference<Buffer> {
Expand Down