Example #1
0
            ///// <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(Buf, _type);
                int elements            = _size / SizeOf();

                mfis.ReadToByteBuffer(buff, elements, storage);
                //skip padding
                if (padding > 0)
                {
                    Buf.ReadBytes(padding);
                }
            }
Example #2
0
            /// <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
                var elements = _size / SizeOf();
                var ac       = new char[elements];

                var mfis = new MatFileInputStream(Buf, _type);

                for (var i = 0; i < elements; i++)
                {
                    ac[i] = mfis.ReadChar();
                }

                // skip padding
                if (padding > 0)
                {
                    Buf.ReadBytes(padding);
                }
                return(ac);
            }
Example #3
0
            /// <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
                var elements = _size / SizeOf();
                var ad       = new double[elements];

                var mfis = new MatFileInputStream(Buf, _type);

                for (var i = 0; i < elements; i++)
                {
                    ad[i] = mfis.ReadDouble();
                }

                // skip padding
                if (padding > 0)
                {
                    Buf.ReadBytes(padding);
                }
                return(ad);
            }
Example #4
0
            /// <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
                var elements = _size / SizeOf();
                var ai       = new int[elements];

                var mfis = new MatFileInputStream(Buf, _type);

                for (var i = 0; i < elements; i++)
                {
                    ai[i] = mfis.ReadInt();
                }

                // skip padding
                if (padding > 0)
                {
                    Buf.ReadBytes(padding);
                }
                return(ai);
            }
Example #5
0
            /// <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);
            }
            /// <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>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>
 ///// 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, ByteStorageSupport 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>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;
            }