///// <summary> ///// Gets the size of the <c>ISMatTag</c> ///// </summary> //public int Size //{ // get { return (int)Buf.BaseStream.Length; } //} /// <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(this.Buf, this._type); int elements = this._size / this.SizeOf(); mfis.ReadToByteBuffer(buff, elements, storage); //skip padding if (this.padding > 0) { this.Buf.ReadBytes(this.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 = this._size / this.SizeOf(); char[] ac = new char[elements]; MatFileInputStream mfis = new MatFileInputStream(this.Buf, this._type); for (int i = 0; i < elements; i++) { ac[i] = mfis.ReadChar(); } // skip padding if (this.padding > 0) { this.Buf.ReadBytes(this.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 = this._size / this.SizeOf(); int[] ai = new int[elements]; MatFileInputStream mfis = new MatFileInputStream(this.Buf, this._type); for (int i = 0; i < elements; i++) { ai[i] = mfis.ReadInt(); } // skip padding if (this.padding > 0) { this.Buf.ReadBytes(this.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 = this._size / this.SizeOf(); double[] ad = new double[elements]; MatFileInputStream mfis = new MatFileInputStream(this.Buf, this._type); for (int i = 0; i < elements; i++) { ad[i] = mfis.ReadDouble(); } // skip padding if (this.padding > 0) { this.Buf.ReadBytes(this.padding); } return(ad); }