def store_header_footer_common(type)  # :nodoc:
    if type == :header
      record   = 0x0014
      str      = @header || ''
      encoding = @header_encoding || 0
    else
      record   = 0x0015
      str      = @footer || ''
      encoding = @footer_encoding || 0
    end
    cch         = str.bytesize        # Length of header/footer string

    # Character length is num of chars not num of bytes
    cch         /= 2 if encoding != 0

    # Change the UTF-16 name from BE to LE
    str         = str.unpack('v*').pack('n*') if encoding != 0

    length      = 3 + str.bytesize

    header      = [record, length].pack('vv')
    data        = [cch, encoding].pack('vC')

    prepend(header, data, str)
  end
def store_header_footer_common(type)  # :nodoc:
    if type == :header
      record   = 0x0014
      str      = @header || ''
      encoding = @header_encoding || 0
    else
      record   = 0x0015
      str      = @footer || ''
      encoding = @footer_encoding || 0
    end
    cch         = str.bytesize        # Length of header/footer string

    # Character length is num of chars not num of bytes
    cch         /= 2 if encoding != 0

    # Change the UTF-16 name from BE to LE
    str         = str.unpack('v*').pack('n*') if encoding != 0

    length      = 3 + str.bytesize

    header      = [record, length].pack('vv')
    data        = [cch, encoding].pack('vC')

    prepend(header, data, str)
  end
type :  :header / :footer