Class Leader

  • All Implemented Interfaces:
    Serializable, Cloneable

    public class Leader
    extends Object
    implements Serializable, Cloneable
    Leader defines behaviour for the record label (record position 00-23).

    The leader is a fixed field that occurs at the beginning of a MARC record and provides information for the processing of the record. The structure of the leader according to the MARC standard is as follows:

     RECORD_LENGTH RECORD_STATUS TYPE_OF_RECORD IMPLEMENTATION-DEFINED CHARACTER_CODING_SCHEME  INDICATOR_COUNT SUBFIELD_CODE_LENGTH BASE_ADDRESS_OF_DATA  IMPLEMENTATION-DEFINED  ENTRY_MAP
     00-04         05            06             07-08                  09                       10              11                   12-16                 17-19                   20-23
     

    This structure is returned by the marshal() method.

    Author:
    Bas Peters
    See Also:
    Serialized Form
    • Constructor Detail

      • Leader

        public Leader()
      • Leader

        public Leader​(String ldr)
      • Leader

        public Leader​(Leader other)
        Copy constructor
    • Method Detail

      • newEmptyLeader

        public static Leader newEmptyLeader()
      • setRecordLength

        public void setRecordLength​(int recordLength)

        Registers the logical record length (positions 00-04).

        Parameters:
        recordLength - integer representing the record length
      • setRecordStatus

        public void setRecordStatus​(char recordStatus)

        Registers the record status (position 05).

        Parameters:
        recordStatus - character representing the record status
      • setTypeOfRecord

        public void setTypeOfRecord​(char typeOfRecord)

        Registers the type of record (position 06).

        Parameters:
        typeOfRecord - character representing the type of record
      • setImplDefined1

        public void setImplDefined1​(char[] implDefined1)

        Registers implementation defined values (position 07-08).

        Parameters:
        implDefined1 - character array representing the implementation defined data
      • setCharCodingScheme

        public void setCharCodingScheme​(char charCodingScheme)

        Registers the character encoding scheme (position 09).

        Parameters:
        charCodingScheme - character representing the character encoding
      • setIndicatorCount

        public void setIndicatorCount​(int indicatorCount)

        Registers the indicator count (position 10).

        Parameters:
        indicatorCount - integer representing the number of indicators present in a data field
      • setSubfieldCodeLength

        public void setSubfieldCodeLength​(int subfieldCodeLength)

        Registers the subfield code length (position 11).

        Parameters:
        subfieldCodeLength - integer representing the subfield code length
      • setBaseAddressOfData

        public void setBaseAddressOfData​(int baseAddressOfData)

        Registers the base address of data (positions 12-16).

        Parameters:
        baseAddressOfData - integer representing the base address of data
      • setImplDefined2

        public void setImplDefined2​(char[] implDefined2)

        Registers implementation defined values (positions 17-19).

        Parameters:
        implDefined2 - character array representing the implementation defined data
      • setEntryMap

        public void setEntryMap​(char[] entryMap)

        Registers the entry map (positions 20-23).

        Parameters:
        entryMap - character array representing the entry map
      • getRecordLength

        public int getRecordLength()

        Returns the logical record length (positions 00-04).

        Returns:
        int - the record length
      • getRecordStatus

        public char getRecordStatus()

        Returns the record status (positions 05).

        Returns:
        char - the record status
      • getTypeOfRecord

        public char getTypeOfRecord()

        Returns the record type (position 06).

        Returns:
        char - the record type
      • getImplDefined1

        public char[] getImplDefined1()

        Returns implementation defined values (positions 07-08).

        Returns:
        char[] - implementation defined values
      • getCharCodingScheme

        public char getCharCodingScheme()

        Returns the character coding scheme (position 09).

        Returns:
        char - the character coding scheme
      • getIndicatorCount

        public int getIndicatorCount()

        Returns the indicator count (positions 10).

        Returns:
        int - the indicator count
      • getSubfieldCodeLength

        public int getSubfieldCodeLength()

        Returns the subfield code length (position 11).

        Returns:
        int - the subfield code length
      • getBaseAddressOfData

        public int getBaseAddressOfData()

        Returns the base address of data (positions 12-16).

        Returns:
        int - the base address of data
      • getImplDefined2

        public char[] getImplDefined2()

        Returns implementation defined values (positions 17-19).

        Returns:
        char - implementation defined values
      • getEntryMap

        public char[] getEntryMap()

        Returns the entry map (positions 20-23).

        Returns:
        char[] - the entry map
      • unmarshal

        public void unmarshal​(String ldr)
                       throws MarcException

        Creates a leader object from a string object.

        Indicator count and subfield code length are defaulted to 2 if they are not integer values.

        Parameters:
        ldr - the leader
        Throws:
        MarcException
      • marshal

        public String marshal()
        Returns a String representation of the record label following the MARC structure.

        Example:

          00714cam a2200205 a 4500
         
        Returns:
        String - the record label