|
@@ -1341,62 +1341,4 @@ public final class BufferUtils {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public static class ByteShortIntBufferReader {
|
|
|
|
- Buffer buffer;
|
|
|
|
-
|
|
|
|
- public ByteShortIntBufferReader() {
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public ByteShortIntBufferReader(Buffer buffer) {
|
|
|
|
- this.buffer = buffer;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public int get() {
|
|
|
|
- if (buffer instanceof ByteBuffer) {
|
|
|
|
- return ((ByteBuffer) buffer).get();
|
|
|
|
- } else if (buffer instanceof ShortBuffer) {
|
|
|
|
- return ((ShortBuffer) buffer).get();
|
|
|
|
- } else if (buffer instanceof IntBuffer) {
|
|
|
|
- return ((IntBuffer) buffer).get();
|
|
|
|
- } else {
|
|
|
|
- throw new UnsupportedOperationException("Buffer must be a ByteBuffer, a ShortBuffer or an IntBuffer");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public int get(int index) {
|
|
|
|
- if (buffer instanceof ByteBuffer) {
|
|
|
|
- return ((ByteBuffer) buffer).get(index);
|
|
|
|
- } else if (buffer instanceof ShortBuffer) {
|
|
|
|
- return ((ShortBuffer) buffer).get(index);
|
|
|
|
- } else if (buffer instanceof IntBuffer) {
|
|
|
|
- return ((IntBuffer) buffer).get(index);
|
|
|
|
- } else {
|
|
|
|
- throw new UnsupportedOperationException("Buffer must be a ByteBuffer, a ShortBuffer or an IntBuffer");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public int getUnsigned(int index) {
|
|
|
|
- if (buffer instanceof ByteBuffer) {
|
|
|
|
- return ((ByteBuffer) buffer).get(index) & 0xff;
|
|
|
|
- } else if (buffer instanceof ShortBuffer) {
|
|
|
|
- return ((ShortBuffer) buffer).get(index) & 0xffff;
|
|
|
|
- } else if (buffer instanceof IntBuffer) {
|
|
|
|
- return ((IntBuffer) buffer).get(index) & 0xffffff;
|
|
|
|
- } else {
|
|
|
|
- throw new UnsupportedOperationException("Buffer must be a ByteBuffer, a ShortBuffer or an IntBuffer");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void setBuffer(Buffer buffer) {
|
|
|
|
- this.buffer = buffer;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void rewind() {
|
|
|
|
- buffer.rewind();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public int remaining() {
|
|
|
|
- return buffer.remaining();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|