public void readToByteBuffer(ByteBuffer buff, ByteStorageSupport<?> storage) throws IOException { MatFileInputStream mfis = new MatFileInputStream(buf, type); int elements = size / sizeOf(); mfis.readToByteBuffer(buff, elements, storage); // skip padding if (padding > 0) { buf.position(buf.position() + padding); } }