Class Directory

  • All Implemented Interfaces:
    Serializable

    public class Directory
    extends Object
    implements Serializable

    Directory is a helper class to build a directory.

    The directory is an index to the location of the variable fields within a record. The directory consists of entries. Each directory entry is 12 characters in length. The structure of each entry according to the MARC standard is as follows:

     TAG     LENGTH_OF_FIELD     STARTING_CHARACTER_POSITION
     00-02   03-06               07-11
     

    This structure is returned by the marshal() method.

    The starting character position gives the starting position of the variable field to which the entry corresponds relative to the base address of data of the record. A starting character position or length of field of fewer than five digits is right justified and unused positions contain zero's.

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

      • Directory

        public Directory()

        Default constructor.

    • Method Detail

      • add

        public void add​(String tag,
                        int length)

        Adds a new entry to the directory.

        Parameters:
        tag - the tag name
        length - the length of field
      • marshal

        public String marshal()

        Returns a String representation for the directory following the structure of the MARC directory.

        Returns:
        String - the directory
      • getLength

        public int getLength()

        Returns the length of the serialized form of the directory.

        Returns:
        int - the directory length