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); } }
public byte[] readToByteArray() throws IOException { // allocate memory for array elements int elements = size / sizeOf(); byte[] ab = new byte[elements]; MatFileInputStream mfis = new MatFileInputStream(buf, type); for (int i = 0; i < elements; i++) { ab[i] = mfis.readByte(); } // skip padding if (padding > 0) { buf.position(buf.position() + padding); } return ab; }
public char[] readToCharArray() throws IOException { // allocate memory for array elements int elements = size / sizeOf(); char[] ac = new char[elements]; MatFileInputStream mfis = new MatFileInputStream(buf, type); for (int i = 0; i < elements; i++) { ac[i] = mfis.readChar(); } // skip padding if (padding > 0) { buf.position(buf.position() + padding); } return ac; } }
public double[] readToDoubleArray() throws IOException { // allocate memory for array elements int elements = size / sizeOf(); double[] ad = new double[elements]; MatFileInputStream mfis = new MatFileInputStream(buf, type); for (int i = 0; i < elements; i++) { ad[i] = mfis.readDouble(); } // skip padding if (padding > 0) { buf.position(buf.position() + padding); } return ad; }
public int[] readToIntArray() throws IOException { // allocate memory for array elements int elements = size / sizeOf(); int[] ai = new int[elements]; MatFileInputStream mfis = new MatFileInputStream(buf, type); for (int i = 0; i < elements; i++) { ai[i] = mfis.readInt(); } // skip padding if (padding > 0) { buf.position(buf.position() + padding); } return ai; }
final DataType dataType = getDataType(clazz); while ( dest.remaining() > 0 ) dest.putDouble( readDouble() ); continue; case BYTE: dest.put( readByte() ); continue; case INTEGER: dest.putInt( readInt() ); continue; case LONG: dest.putLong( readLong() ); continue; case FLOAT: dest.putFloat( readFloat() ); continue; case UNSUPPORTED: