Exemple #1
0
        /// <summary>
        /// Read data from current DataClient as a byte array
        /// </summary>
        /// <returns>data in current DataClient as a byte array</returns>
        private byte[] ReadRawBytesAllInternal()
        {
            byte[] dataArray = this.ReadBytes();
            if (dataArray == null || dataArray.Length == 0)
            {
                throw new DataException(DataErrorCode.NoDataAvailable, null, this.Id);
            }

            try
            {
                RawBytesDataContent content = RawBytesDataContent.Parse(dataArray);
                return(content.RawBytes);
            }
            catch (Exception e)
            {
                TraceHelper.TraceSource.TraceEvent(TraceEventType.Error, 0, "[DataClient] .ReadRawBytesAll: failed to decompress data");
                throw new DataException(DataErrorCode.DataInconsistent, e, this.Id);
            }
        }
Exemple #2
0
        /// <summary>
        /// Write a byte array to current DataClient
        /// </summary>
        /// <param name="dataBytes">byte array to be written</param>
        /// <param name="compressible">a flag indicating whether the byte array is compressible or not</param>
        private void WriteRawBytesAllInternal(byte[] dataBytes, bool compressible)
        {
            RawBytesDataContent content = new RawBytesDataContent(dataBytes, compressible);

            this.WriteContent(content);
        }