/**
         *
         * @return the sid of the next record or {@link #INVALID_SID_VALUE} if at end of stream
         */

        private int ReadNextSid()
        {
            int nAvailable = _bhi.Available();

            if (nAvailable < EOFRecord.ENCODED_SIZE)
            {
                if (nAvailable > 0)
                {
                    // some scrap left over?
                    // ex45582-22397.xls has one extra byte after the last record
                    // Excel reads that file OK
                }
                return(INVALID_SID_VALUE);
            }
            int result = _bhi.ReadRecordSID();

            if (result == INVALID_SID_VALUE)
            {
                throw new RecordFormatException("Found invalid sid (" + result + ")");
            }
            _currentDataLength = DATA_LEN_NEEDS_TO_BE_READ;

            return(result);
        }