//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public void newRecord(final DDMCallbackEvent event, final DDMDataBuffer dataBuffer)
        public void newRecord(DDMCallbackEvent @event, DDMDataBuffer dataBuffer)
        {
            if (eof_)
            {
                return;
            }
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final byte[] tempData = dataBuffer.getRecordDataBuffer();
            sbyte[] tempData = dataBuffer.RecordDataBuffer;
            //final int recordNumber = dataBuffer.getRecordNumber();

            string fileName   = Conv.ebcdicByteArrayToString(tempData, 13, 10).Trim(); // MBFILE
            string libName    = Conv.ebcdicByteArrayToString(tempData, 23, 10).Trim(); // MBLIB
            string fileType   = Conv.ebcdicByteArrayToString(tempData, 33, 1);         // MBFTYP
            string fileAttrib = Conv.ebcdicByteArrayToString(tempData, 41, 6).Trim();  // MBFATR
            string systemName = Conv.ebcdicByteArrayToString(tempData, 47, 8).Trim();  // MBSYSN
            //int aspID = Integer.valueOf(Conv.packedDecimalToString(tempData, 55, 3, 0)); // MBASP
            string dataType = Conv.ebcdicByteArrayToString(tempData, 61, 1);           // MBDTAT
            //int maxFileWaitTime = Integer.valueOf(Conv.packedDecimalToString(tempData, 62, 5, 0)); //MBWAIT
            //int maxRecordWaitTime = Integer.valueOf(Conv.packedDecimalToString(tempData, 65, 5, 0)); // MBWATR
            //String rfLevelCheck = Conv.ebcdicByteArrayToString(tempData, 69, 1); // MBLVLC
            string description = Conv.ebcdicByteArrayToString(tempData, 70, 50).Trim();                   // MBTXT
            //int numRecordFormats = Integer.valueOf(Conv.packedDecimalToString(tempData, 120, 5, 0)); // MBNOFM
            string memberName        = Conv.ebcdicByteArrayToString(tempData, 163, 10).Trim();            // MBNAME
            string memberDescription = Conv.ebcdicByteArrayToString(tempData, 193, 50).Trim();            // MBMTXT
            long   recordCapacity    = Convert.ToInt64(Conv.packedDecimalToString(tempData, 337, 10, 0)); // MBRCDC
            long   currentRecords    = Convert.ToInt64(Conv.packedDecimalToString(tempData, 343, 10, 0)); // MBNRCD
            long   deletedRecords    = Convert.ToInt64(Conv.packedDecimalToString(tempData, 349, 10, 0)); // MBNDTR

            memberDescriptions_.Add(new DDMFileMemberDescription(fileName, libName, fileType, fileAttrib, systemName, dataType, description, memberName, memberDescription, recordCapacity, currentRecords, deletedRecords));
        }
        /// <summary>
        /// Do not call this method directly; it is implemented for DDMConnection to call.
        ///
        /// </summary>
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public final void newRecord(final DDMCallbackEvent event, final DDMDataBuffer buffer)
        public void newRecord(DDMCallbackEvent @event, DDMDataBuffer buffer)
        {
            buffer.startProcessing();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final DDMFile file = event.getFile();
            DDMFile file = @event.File;

            if (file == file_)
            {
                DDMDataBuffer nextBuffer = file.NextDataBuffer;
                // Wait to use the next buffer until our background thread is done with it.
                while (nextBuffer.Processing)         // Uses volatile variable, faster than synchronization, at the cost of a CPU loop here.
                {
                    file.nextBuffer();                // Advance.
                    nextBuffer = file.NextDataBuffer; // Check the next one.
                }
            }
        }
        /// <summary>
        /// Do not call this method directly; it is implemented for DDMConnection to call.
        ///
        /// </summary>
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public final void endOfFile(final DDMCallbackEvent event)
        public void endOfFile(DDMCallbackEvent @event)
        {
            finish();
        }
        /// <summary>
        /// Do not call this method directly; it is implemented for DDMConnection to call.
        ///
        /// </summary>
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public final void recordNotFound(final DDMCallbackEvent event)
        public void recordNotFound(DDMCallbackEvent @event)
        {
            finish();
        }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public void newRecord(final DDMCallbackEvent event, final DDMDataBuffer dataBuffer)
        public void newRecord(DDMCallbackEvent @event, DDMDataBuffer dataBuffer)
        {
            if (eof_)
            {
                return;
            }
            //    int rfCount = Integer.valueOf(Conv.zonedDecimalToString(tempData, 28, 5, 0)); // WHCNT
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final byte[] tempData = dataBuffer.getRecordDataBuffer();
            sbyte[] tempData = dataBuffer.RecordDataBuffer;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int recordNumber = dataBuffer.getRecordNumber();
            int recordNumber = dataBuffer.RecordNumber;

            if (fields_ == null)
            {
                int numFields = Convert.ToInt32(Conv.zonedDecimalToString(tempData, 361, 5, 0)); // WHNFLD
                fields_  = new DDMField[numFields];
                name_    = Conv.ebcdicByteArrayToString(tempData, 46, 10);                       // WHNAME
                library_ = Conv.ebcdicByteArrayToString(tempData, 10, 10);                       // WHLIB
                file_    = Conv.ebcdicByteArrayToString(tempData, 0, 10);                        // WHFILE
                type_    = Conv.ebcdicByteArrayToString(tempData, 27, 1);                        // WHFTYP
                text_    = Conv.ebcdicByteArrayToString(tempData, 69, 50);                       // WHTEXT
                if (numFields == 0)
                {
                    return;       // Save files have no fields, for example.
                }
            }
            else if (recordNumber > fields_.Length)
            {
                //TODO - More than one record format, we'll support that later.
                eof_ = true;
                return;
            }

            string fieldName        = Conv.ebcdicByteArrayToString(tempData, 139, 10).Trim();          // WHFLDE;
            int    fieldByteLength  = Convert.ToInt32(Conv.zonedDecimalToString(tempData, 159, 5, 0)); // WHFLDB
            int    numDigits        = Convert.ToInt32(Conv.zonedDecimalToString(tempData, 164, 2, 0)); // WHFLDO
            int    decimalPositions = Convert.ToInt32(Conv.zonedDecimalToString(tempData, 166, 2, 0)); // WHFLDP
            string fieldText        = Conv.ebcdicByteArrayToString(tempData, 168, 50);                 // WHFTXT
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final char fieldType = Conv.ebcdicByteArrayToString(tempData, 321, 1).charAt(0);
            char   fieldType          = Conv.ebcdicByteArrayToString(tempData, 321, 1)[0];                                              // WHFLDT
            int    defaultValueLength = Convert.ToInt32(Conv.zonedDecimalToString(tempData, 402, 2, 0));                                // WHDFTL
            string defaultValue       = Conv.ebcdicByteArrayToString(tempData, 404, defaultValueLength > 30 ? 30 : defaultValueLength); // WHDFT
            int    ccsid               = Convert.ToInt32(Conv.packedDecimalToString(tempData, 491, 5, 0));                              // WHCCSID
            string dateTimeFormat      = Conv.ebcdicByteArrayToString(tempData, 494, 4);                                                // WHFMT
            string dateTimeSeparator   = Conv.ebcdicByteArrayToString(tempData, 498, 1);                                                // WHSEP
            string variableLengthField = Conv.ebcdicByteArrayToString(tempData, 499, 1);                                                // WHVARL
            int    allocatedLength     = Convert.ToInt32(Conv.packedDecimalToString(tempData, 500, 5, 0));                              // WHALLC
            string allowNulls          = Conv.ebcdicByteArrayToString(tempData, 503, 1);                                                // WHNULL;

            if (ccsid == 65535)
            {
                ccsid = serverCCSID_;
            }

            fields_[recordNumber - 1] = new DDMField(totalLength_, fieldName, fieldByteLength, numDigits, decimalPositions, fieldText, fieldType, defaultValue, ccsid, variableLengthField, allocatedLength, allowNulls, dateTimeFormat, dateTimeSeparator);
            totalLength_ += fieldByteLength;
            //    String alias = Conv.ebcdicByteArrayToString(tempData, 370,30); // WHALIS
        }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public void endOfFile(final DDMCallbackEvent event)
        public void endOfFile(DDMCallbackEvent @event)
        {
            eof_ = true;
        }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public void recordNotFound(final DDMCallbackEvent event)
        public void recordNotFound(DDMCallbackEvent @event)
        {
            eof_ = true;
        }