org.marc4j.marc
Class ControlField

java.lang.Object
  |
  +--org.marc4j.marc.VariableField
        |
        +--org.marc4j.marc.ControlField
All Implemented Interfaces:
Serializable

public class ControlField
extends VariableField
implements Serializable

ControlField defines behaviour for a control field (tag 001-009).

Control fields are variable fields identified by tags beginning with two zero's. They are comprised of data and a field terminator and do not contain indicators or subfield codes. The structure of a control field according to the MARC standard is as follows:

 DATA_ELEMENT FIELD_TERMINATOR
 

This structure is returned by the marshal() method.

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

Field Summary
 
Fields inherited from class org.marc4j.marc.VariableField
FT
 
Constructor Summary
ControlField()
          Default constructor.
ControlField(String tag, char[] data)
          Creates a new control field instance and registers the tag and the control field data.
ControlField(String tag, String data)
          Creates a new control field instance and registers the tag and the control field data.
 
Method Summary
 char[] getData()
          Returns the control field data.
 int getLength()
          Returns the length of the serialized form of the control field.
 String getTag()
          Returns the tag name.
 String marshal()
          Returns a String representation for a control field following the structure of a MARC control field.
 void setData(char[] data)
          Registers the control field data.
 void setData(String data)
          Registers the control field data.
 void setTag(String tag)
          Registers the tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ControlField

public ControlField()

Default constructor.


ControlField

public ControlField(String tag,
                    char[] data)

Creates a new control field instance and registers the tag and the control field data.

Parameters:
tag - the tag name
data - the control field data

ControlField

public ControlField(String tag,
                    String data)

Creates a new control field instance and registers the tag and the control field data.

Parameters:
tag - the tag name
data - the control field data
Method Detail

setTag

public void setTag(String tag)

Registers the tag.

Overrides:
setTag in class VariableField
Parameters:
tag - the tag name
Throws:
IllegalTagException - when the tag is not a valid control field identifier

getTag

public String getTag()

Returns the tag name.

Overrides:
getTag in class VariableField
Returns:
String - the tag name

setData

public void setData(char[] data)

Registers the control field data.

Parameters:
data - the control field data

setData

public void setData(String data)

Registers the control field data.

Parameters:
data - the control field data

getData

public char[] getData()

Returns the control field data.

Returns:
char[] - control field as a character array

marshal

public String marshal()

Returns a String representation for a control field following the structure of a MARC control field.

Returns:
String - control field

getLength

public int getLength()

Returns the length of the serialized form of the control field.

Returns:
int - length of control field


Copyright 2001-2003 Bas Peters. All Rights Reserved.