예제 #1
0
 internal void setEncoding(EncodingVersion encoding)
 {
     this.encoding = encoding;
     encoding_1_0 = encoding.Equals(Util.Encoding_1_0);
 }
예제 #2
0
        /// <summary>
        /// Skips an empty encapsulation.
        /// </summary>
        /// <returns>The encapsulation's encoding version.</returns>
        public EncodingVersion skipEmptyEncapsulation()
        {
            int sz = readInt();
            if(sz < 6)
            {
                throw new EncapsulationException();
            }
            if(sz - 4 > _buf.b.remaining())
            {
                throw new UnmarshalOutOfBoundsException();
            }

            var encoding = new EncodingVersion();
            encoding.read__(this);
            if(encoding.Equals(Util.Encoding_1_0))
            {
                if(sz != 6)
                {
                    throw new EncapsulationException();
                }
            }
            else
            {
                // Skip the optional content of the encapsulation if we are expecting an
                // empty encapsulation.
                _buf.b.position(_buf.b.position() + sz - 6);
            }
            return encoding;
        }