/// <summary> /// Read MAT-file tag to a byte buffer. /// </summary> /// <param name="buff"><c>ByteBuffer</c></param> /// <param name="storage"><c>ByteStorageSupport</c></param> public void ReadToByteBuffer(ByteBuffer buff, IByteStorageSupport storage) { MatFileInputStream mfis = new MatFileInputStream(Buf, _type); int elements = _size / SizeOf(); mfis.ReadToByteBuffer(buff, elements, storage); //skip padding if (padding > 0) { Buf.ReadBytes(padding); } }
/// <summary> /// Read MAT-file tag to a <c>char</c> array /// </summary> /// <returns><c>int[]</c></returns> public char[] ReadToCharArray() { // 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.ReadBytes(padding); } return(ac); }
/// <summary> /// Read MAT-file tag to a <c>int</c> array /// </summary> /// <returns><c>int[]</c></returns> public int[] ReadToIntArray() { // 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.ReadBytes(padding); } return(ai); }
/// <summary> /// Read MAT-file tag to a <c>double</c> array /// </summary> /// <returns><c>double[]</c></returns> public double[] ReadToDoubleArray() { // 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.ReadBytes(padding); } return(ad); }
/// <summary> /// Read MAT-file tag to a <c>byte</c> array /// </summary> /// <returns><c>byte[]</c></returns> public byte[] ReadToByteArray() { // 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.ReadBytes(padding); } return(ab); }