Package org.marc4j.util
Class TaggedWriter
- java.lang.Object
-
- org.marc4j.util.TaggedWriter
-
- All Implemented Interfaces:
MarcHandler
public class TaggedWriter extends Object implements MarcHandler
Implements the
MarcHandler
interface to write MARC data in tagged display format.- Author:
- Bas Peters
- See Also:
MarcHandler
-
-
Constructor Summary
Constructors Constructor Description TaggedWriter()
Default constructor.TaggedWriter(OutputStream out)
Creates a new instance.TaggedWriter(OutputStream out, String encoding)
Creates a new instance.TaggedWriter(Writer out)
Creates a new instance and registers the Writer object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
controlField(String tag, char[] data, Long id)
Receives notification of a control field.void
endCollection()
Receives notification at the end of the collection.void
endDataField(String tag)
Receives notification at the end of each data fieldvoid
endRecord()
Receives notification at the end of each record.void
setWriter(Writer out)
Registers the Writer object.void
startCollection()
System exits when the Writer object is null.void
startDataField(String tag, char ind1, char ind2, Long id)
Receives notification at the start of each data field.void
startRecord(Leader leader)
Receives notification at the start of each record.void
subfield(char code, char[] data, String linkCode)
Receives notification of a data element (subfield).
-
-
-
Constructor Detail
-
TaggedWriter
public TaggedWriter() throws IOException
Default constructor.
- Throws:
IOException
-
TaggedWriter
public TaggedWriter(OutputStream out) throws IOException
Creates a new instance.
- Parameters:
out
- theOutputStream
object- Throws:
IOException
-
TaggedWriter
public TaggedWriter(OutputStream out, String encoding) throws IOException
Creates a new instance.
- Parameters:
out
- theOutputStream
objectencoding
- the encoding- Throws:
IOException
-
-
Method Detail
-
setWriter
public void setWriter(Writer out)
Registers the Writer object.
- Parameters:
out
- theWriter
object
-
startCollection
public void startCollection()
System exits when the Writer object is null.
- Specified by:
startCollection
in interfaceMarcHandler
-
startRecord
public void startRecord(Leader leader)
Description copied from interface:MarcHandler
Receives notification at the start of each record.
- Specified by:
startRecord
in interfaceMarcHandler
- Parameters:
leader
- theLeader
object containing the record label
-
controlField
public void controlField(String tag, char[] data, Long id)
Description copied from interface:MarcHandler
Receives notification of a control field.
- Specified by:
controlField
in interfaceMarcHandler
- Parameters:
tag
- the tag namedata
- the control field dataid
- the field id if exists.
-
startDataField
public void startDataField(String tag, char ind1, char ind2, Long id)
Description copied from interface:MarcHandler
Receives notification at the start of each data field.
- Specified by:
startDataField
in interfaceMarcHandler
- Parameters:
tag
- the tag nameind1
- the first indicator valueind2
- the second indicator valueid
- the field id if exists.
-
subfield
public void subfield(char code, char[] data, String linkCode)
Description copied from interface:MarcHandler
Receives notification of a data element (subfield).
- Specified by:
subfield
in interfaceMarcHandler
- Parameters:
code
- the data element identifierdata
- the data elementlinkCode
- a code if the subfield has a link with another Record
-
endDataField
public void endDataField(String tag)
Description copied from interface:MarcHandler
Receives notification at the end of each data field
- Specified by:
endDataField
in interfaceMarcHandler
- Parameters:
tag
- the tag name
-
endRecord
public void endRecord()
Description copied from interface:MarcHandler
Receives notification at the end of each record.
- Specified by:
endRecord
in interfaceMarcHandler
-
endCollection
public void endCollection()
Description copied from interface:MarcHandler
Receives notification at the end of the collection.
- Specified by:
endCollection
in interfaceMarcHandler
-
-