예제 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean writeHeader(BigEndianByteArrayBuffer key, BigEndianByteArrayBuffer value) throws java.io.IOException
        public virtual bool WriteHeader(BigEndianByteArrayBuffer key, BigEndianByteArrayBuffer value)
        {
            bool result = _state.header(this, value.AllZeroes() || value.MinusOneAtTheEnd());

            DoWrite(key, value, State.Done);
            return(result);
        }
예제 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void doWrite(BigEndianByteArrayBuffer key, BigEndianByteArrayBuffer value, State expectedNextState) throws java.io.IOException
        private void DoWrite(BigEndianByteArrayBuffer key, BigEndianByteArrayBuffer value, State expectedNextState)
        {
            this._keySize   = key.Size();
            this._valueSize = value.Size();
            Debug.Assert(key.AllZeroes(), "key should have been cleared by previous call");
            if (!Write(key, value))
            {
                if (_state != expectedNextState)
                {
                    _state = State.InError;
                    throw new System.InvalidOperationException("MetadataCollector stopped before " + expectedNextState + " reached.");
                }
            }
        }
예제 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void writeData(BigEndianByteArrayBuffer key, BigEndianByteArrayBuffer value) throws java.io.IOException
        public virtual void WriteData(BigEndianByteArrayBuffer key, BigEndianByteArrayBuffer value)
        {
            _state.data(this);
            Debug.Assert(key.Size() == _keySize);
            Debug.Assert(value.Size() == _valueSize);
            if (key.AllZeroes())
            {
                _state = State.InError;
                throw new System.ArgumentException("All-zero keys are not allowed.");
            }
            if (!Write(key, value))
            {
                _state = State.InError;
                throw new System.InvalidOperationException("MetadataCollector stopped on data field.");
            }
        }
예제 #4
0
 private static bool Visitable(BigEndianByteArrayBuffer key, bool acceptZeroKey)
 {
     return(acceptZeroKey || !key.AllZeroes());
 }