public static IndexBuffer wrapIndexBuffer(Buffer buf) {
        if (buf instanceof ByteBuffer) {
            return new IndexByteBuffer((ByteBuffer) buf);
        } else if (buf instanceof ShortBuffer) {
            return new IndexShortBuffer((ShortBuffer) buf);
        } else if (buf instanceof IntBuffer) {
            return new IndexIntBuffer((IntBuffer) buf);
        } else {
            throw new UnsupportedOperationException("Index buffer type unsupported: "+ buf.getClass());
        }
    }
<code>IndexBuffer</code> is an abstraction for integer index buffers,
it is used to retrieve indices without knowing in which format they 
are stored (ushort or uint).

@author lex
jme3-core/src/main/java/com/jme3/scene/mesh/IndexBuffer.java