public class MarcXchangeWriter extends MarcContentHandler implements java.io.Flushable, java.io.Closeable
content, format, listeners, marcListener, marcValueTransformers, recordCounter, stack, type
BIBLIOGRAPHIC_TYPE, CODE_ATTRIBUTE, COLLECTION, CONTROLFIELD, DATAFIELD, FORMAT_ATTRIBUTE, HOLDINGS_TYPE, IND_ATTRIBUTE, LEADER, MARC21_FORMAT, MARC21_SCHEMA_LOCATION, MARC21_SCHEMA_URI, MARCXCHANGE_FORMAT, MARCXCHANGE_V1_NS_URI, MARCXCHANGE_V2_0_SCHEMA_LOCATION, MARCXCHANGE_V2_NS_URI, RECORD, SUBFIELD, TAG_ATTRIBUTE, TYPE_ATTRIBUTE
Constructor and Description |
---|
MarcXchangeWriter(java.io.OutputStream out)
Create a MarcXchange writer on an underlying output stream.
|
MarcXchangeWriter(java.io.OutputStream out,
boolean indent)
Create a MarcXchange writer on an underlying output stream.
|
MarcXchangeWriter(java.lang.String fileNamePattern,
int splitlimit,
int bufferSize,
boolean compress,
boolean indent)
Create a MarcXchange writer in "split writer" mode.
|
MarcXchangeWriter(java.io.Writer writer)
Create a MarcXchange writer on an underlying writer.
|
MarcXchangeWriter(java.io.Writer writer,
boolean indent)
Create a MarcXchange writer on an underlying writer.
|
MarcXchangeWriter(javax.xml.stream.util.XMLEventConsumer consumer)
Write MarcXchange to an XML event consumer.
|
Modifier and Type | Method and Description |
---|---|
void |
beginCollection()
Begin of a record collection.
|
void |
beginRecord(java.lang.String format,
java.lang.String type)
Begin of a record.
|
void |
close() |
void |
endCollection()
End of a collection.
|
void |
endCustomElement(java.lang.String prefix,
java.lang.String uri,
java.lang.String localname) |
void |
endDocument() |
void |
endRecord()
End of a record.
|
void |
field(MarcField field)
A field.
|
void |
flush() |
java.lang.Exception |
getException() |
void |
leader(java.lang.String label)
The leader (or label) of a record.
|
void |
record(MarcRecord marcRecord)
Receive a MARC Record.
|
MarcXchangeWriter |
setFatalErrors(boolean fatalErrors) |
MarcXchangeWriter |
setFormat(java.lang.String format) |
MarcXchangeWriter |
setMarcListener(MarcListener listener)
Set MARC listener for the default record type.
|
MarcXchangeWriter |
setMarcValueTransformers(MarcValueTransformers marcValueTransformers)
Set MARC field value transformer for transforming field values.
|
MarcXchangeWriter |
setType(java.lang.String type) |
void |
startCustomElement(java.lang.String prefix,
java.lang.String uri,
java.lang.String localname) |
void |
startDocument() |
addNamespace, characters, endElement, endPrefixMapping, error, fatalError, getDefaultFormat, getDefaultType, getFormat, getRecordCounter, getType, ignorableWhitespace, isNamespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, setMarcFieldTransformers, setMarcListener, skippedEntity, startElement, startPrefixMapping, unparsedEntityDecl, warning
public MarcXchangeWriter(java.io.OutputStream out) throws java.io.IOException
out
- the underlying output streamjava.io.IOException
- if writer can not be createdpublic MarcXchangeWriter(java.io.OutputStream out, boolean indent) throws java.io.IOException
out
- the underlying output streamindent
- if true, indent MarcXchange outputjava.io.IOException
- if writer can not be createdpublic MarcXchangeWriter(java.io.Writer writer) throws java.io.IOException
writer
- the underlying writerjava.io.IOException
- if writer can not be createdpublic MarcXchangeWriter(java.io.Writer writer, boolean indent) throws java.io.IOException
writer
- the underlying writerindent
- if true, indent MarcXchange outputjava.io.IOException
- if writer can not be createdpublic MarcXchangeWriter(java.lang.String fileNamePattern, int splitlimit, int bufferSize, boolean compress, boolean indent) throws java.io.IOException
fileNamePattern
- file name patternsplitlimit
- split write limitbufferSize
- buffer sizecompress
- if true, compress MarcXchange outputindent
- if true, indent MarcXchange outputjava.io.IOException
- if writer can not be createdpublic MarcXchangeWriter(javax.xml.stream.util.XMLEventConsumer consumer)
consumer
- an XML event consumerpublic MarcXchangeWriter setFormat(java.lang.String format)
setFormat
in class MarcContentHandler
public MarcXchangeWriter setType(java.lang.String type)
setType
in class MarcContentHandler
public MarcXchangeWriter setMarcValueTransformers(MarcValueTransformers marcValueTransformers)
MarcContentHandler
setMarcValueTransformers
in class MarcContentHandler
marcValueTransformers
- the value transformerpublic MarcXchangeWriter setFatalErrors(boolean fatalErrors)
public MarcXchangeWriter setMarcListener(MarcListener listener)
MarcContentHandler
setMarcListener
in class MarcContentHandler
listener
- the MARC listenerpublic void startDocument()
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class MarcContentHandler
public void endDocument()
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class MarcContentHandler
public void beginCollection()
MarcListener
beginCollection
in interface MarcListener
beginCollection
in interface MarcRecordListener
beginCollection
in class MarcContentHandler
public void beginRecord(java.lang.String format, java.lang.String type)
MarcListener
beginRecord
in interface MarcListener
beginRecord
in class MarcContentHandler
format
- the record formattype
- the record typepublic void leader(java.lang.String label)
MarcListener
leader
in interface MarcListener
leader
in class MarcContentHandler
label
- the labelpublic void field(MarcField field)
MarcListener
field
in interface MarcListener
field
in class MarcContentHandler
field
- the field.public void endRecord()
MarcListener
endRecord
in interface MarcListener
endRecord
in class MarcContentHandler
public void endCollection()
MarcListener
endCollection
in interface MarcListener
endCollection
in interface MarcRecordListener
endCollection
in class MarcContentHandler
public void record(MarcRecord marcRecord)
MarcRecordListener
record
in interface MarcRecordListener
record
in class MarcContentHandler
marcRecord
- the recordpublic void startCustomElement(java.lang.String prefix, java.lang.String uri, java.lang.String localname)
public void endCustomElement(java.lang.String prefix, java.lang.String uri, java.lang.String localname)
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public java.lang.Exception getException()