def marc4j_to_rubymarc(marc4j)
      rmarc = MARC::Record.new
      rmarc.leader = marc4j.getLeader.marshal

      marc4j.getControlFields.each do |marc4j_control|
        rmarc.append( MARC::ControlField.new(marc4j_control.getTag(), marc4j_control.getData )  )
      end

      marc4j.getDataFields.each do |marc4j_data|
        rdata = MARC::DataField.new(  marc4j_data.getTag,  marc4j_data.getIndicator1.chr, marc4j_data.getIndicator2.chr )

        marc4j_data.getSubfields.each do |subfield|

          # We assume Marc21, skip corrupted data
          # if subfield.getCode is more than 255, subsequent .chr
          # would raise.
          if subfield.getCode > 255
            if @logger
              @logger.warn("Marc4JReader: Corrupted MARC data, record id #{marc4j.getControlNumber}, field #{marc4j_data.tag}, corrupt subfield code byte #{subfield.getCode}. Skipping subfield, but continuing with record.")
            end
            next
          end

          rsubfield = MARC::Subfield.new(subfield.getCode.chr, subfield.getData)
          rdata.append rsubfield
        end

        rmarc.append rdata
      end

      return rmarc
    end
def marc4j_to_rubymarc(marc4j)
      rmarc = MARC::Record.new
      rmarc.leader = marc4j.getLeader.marshal

      marc4j.getControlFields.each do |marc4j_control|
        rmarc.append( MARC::ControlField.new(marc4j_control.getTag(), marc4j_control.getData )  )
      end

      marc4j.getDataFields.each do |marc4j_data|
        rdata = MARC::DataField.new(  marc4j_data.getTag,  marc4j_data.getIndicator1.chr, marc4j_data.getIndicator2.chr )

        marc4j_data.getSubfields.each do |subfield|

          # We assume Marc21, skip corrupted data
          # if subfield.getCode is more than 255, subsequent .chr
          # would raise.
          if subfield.getCode > 255
            if @logger
              @logger.warn("Marc4JReader: Corrupted MARC data, record id #{marc4j.getControlNumber}, field #{marc4j_data.tag}, corrupt subfield code byte #{subfield.getCode}. Skipping subfield, but continuing with record.")
            end
            next
          end

          rsubfield = MARC::Subfield.new(subfield.getCode.chr, subfield.getData)
          rdata.append rsubfield
        end

        rmarc.append rdata
      end

      return rmarc
    end
Get a new coverter
 Given a marc4j record, return a rubymarc record