org.marc4j.marc
Class Directory

java.lang.Object
  |
  +--org.marc4j.marc.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.

Version:
$Revision: 1.5 $
Author:
Bas Peters
See Also:
Serialized Form

Constructor Summary
Directory()
          Default constructor.
 
Method Summary
 void add(String tag, int length)
          Adds a new entry to the directory.
 int getLength()
          Returns the length of the serialized form of the directory.
 String marshal()
          Returns a String representation for the directory following the structure of the MARC directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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


Copyright 2001-2003 Bas Peters. All Rights Reserved.