1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
\r
5 <!-- Generated by javadoc (build 1.5.0_06) on Fri Oct 17 16:04:52 EDT 2008 -->
\r
7 MarcStreamWriter (MARC4J API)
\r
10 <META NAME="keywords" CONTENT="org.marc4j.MarcStreamWriter class">
\r
12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
\r
14 <SCRIPT type="text/javascript">
\r
15 function windowTitle()
\r
17 parent.document.title="MarcStreamWriter (MARC4J API)";
\r
25 <BODY BGCOLOR="white" onload="windowTitle();">
\r
28 <!-- ========= START OF TOP NAVBAR ======= -->
\r
29 <A NAME="navbar_top"><!-- --></A>
\r
30 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
\r
31 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
\r
33 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
\r
34 <A NAME="navbar_top_firstrow"><!-- --></A>
\r
35 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
\r
36 <TR ALIGN="center" VALIGN="top">
\r
37 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
\r
38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
\r
39 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
\r
40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/MarcStreamWriter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
\r
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
\r
42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
\r
43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
\r
44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
\r
48 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
\r
54 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
55 <A HREF="../../org/marc4j/MarcStreamReader.html" title="class in org.marc4j"><B>PREV CLASS</B></A>
\r
56 <A HREF="../../org/marc4j/MarcWriter.html" title="interface in org.marc4j"><B>NEXT CLASS</B></A></FONT></TD>
\r
57 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
58 <A HREF="../../index.html?org/marc4j/MarcStreamWriter.html" target="_top"><B>FRAMES</B></A>
\r
59 <A HREF="MarcStreamWriter.html" target="_top"><B>NO FRAMES</B></A>
\r
60 <SCRIPT type="text/javascript">
\r
63 document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
\r
68 <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
\r
75 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
76 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
\r
77 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
78 DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
\r
81 <A NAME="skip-navbar_top"></A>
\r
82 <!-- ========= END OF TOP NAVBAR ========= -->
\r
85 <!-- ======== START OF CLASS DATA ======== -->
\r
90 Class MarcStreamWriter</H2>
\r
92 <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A>
\r
93 <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>org.marc4j.MarcStreamWriter</B>
\r
96 <DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../org/marc4j/MarcWriter.html" title="interface in org.marc4j">MarcWriter</A></DD>
\r
100 <DT><PRE>public class <B>MarcStreamWriter</B><DT>extends <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A><DT>implements <A HREF="../../org/marc4j/MarcWriter.html" title="interface in org.marc4j">MarcWriter</A></DL>
\r
104 Class for writing MARC record objects in ISO 2709 format.
107 The following example reads a file with MARCXML records and outputs the
108 record set in ISO 2709 format:
112 InputStream input = new FileInputStream("marcxml.xml");
113 MarcXmlReader reader = new MarcXmlReader(input);
114 MarcWriter writer = new MarcStreamWriter(System.out);
115 while (reader.hasNext()) {
116 Record record = reader.next();
117 writer.write(record);
123 To convert characters like for example from UCS/Unicode to MARC-8 register
124 a <A HREF="../../org/marc4j/converter/CharConverter.html" title="class in org.marc4j.converter"><CODE>CharConverter</CODE></A> implementation:
128 InputStream input = new FileInputStream("marcxml.xml");
129 MarcXmlReader reader = new MarcXmlReader(input);
130 MarcWriter writer = new MarcStreamWriter(System.out);
131 writer.setConverter(new UnicodeToAnsel());
132 while (reader.hasNext()) {
133 Record record = reader.next();
134 writer.write(record);
142 <DT><B>Version:</B></DT>
\r
143 <DD>$Revision: 1.4 $</DD>
\r
144 <DT><B>Author:</B></DT>
\r
145 <DD>Bas Peters</DD>
\r
151 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
\r
153 <A NAME="constructor_summary"><!-- --></A>
\r
154 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
155 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
\r
156 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
\r
157 <B>Constructor Summary</B></FONT></TH>
\r
159 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
160 <TD><CODE><B><A HREF="../../org/marc4j/MarcStreamWriter.html#MarcStreamWriter(java.io.OutputStream)">MarcStreamWriter</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStream.html" title="class or interface in java.io">OutputStream</A> out)</CODE>
\r
163 Constructs an instance and creates a <code>Writer</code> object with
164 the specified output stream.</TD>
\r
166 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
167 <TD><CODE><B><A HREF="../../org/marc4j/MarcStreamWriter.html#MarcStreamWriter(java.io.OutputStream, java.lang.String)">MarcStreamWriter</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStream.html" title="class or interface in java.io">OutputStream</A> out,
\r
168 <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> encoding)</CODE>
\r
171 Constructs an instance and creates a <code>Writer</code> object with
172 the specified output stream and character encoding.</TD>
\r
176 <!-- ========== METHOD SUMMARY =========== -->
\r
178 <A NAME="method_summary"><!-- --></A>
\r
179 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
180 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
\r
181 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
\r
182 <B>Method Summary</B></FONT></TH>
\r
184 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
185 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
186 <CODE> void</CODE></FONT></TD>
\r
187 <TD><CODE><B><A HREF="../../org/marc4j/MarcStreamWriter.html#close()">close</A></B>()</CODE>
\r
190 Closes the writer.</TD>
\r
192 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
193 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
194 <CODE> <A HREF="../../org/marc4j/converter/CharConverter.html" title="class in org.marc4j.converter">CharConverter</A></CODE></FONT></TD>
\r
195 <TD><CODE><B><A HREF="../../org/marc4j/MarcStreamWriter.html#getConverter()">getConverter</A></B>()</CODE>
\r
198 Returns the character converter.</TD>
\r
200 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
201 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
202 <CODE> void</CODE></FONT></TD>
\r
203 <TD><CODE><B><A HREF="../../org/marc4j/MarcStreamWriter.html#setConverter(org.marc4j.converter.CharConverter)">setConverter</A></B>(<A HREF="../../org/marc4j/converter/CharConverter.html" title="class in org.marc4j.converter">CharConverter</A> converter)</CODE>
\r
206 Sets the character converter.</TD>
\r
208 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
209 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
210 <CODE> void</CODE></FONT></TD>
\r
211 <TD><CODE><B><A HREF="../../org/marc4j/MarcStreamWriter.html#write(org.marc4j.marc.Record)">write</A></B>(<A HREF="../../org/marc4j/marc/Record.html" title="interface in org.marc4j.marc">Record</A> record)</CODE>
\r
214 Writes a <code>Record</code> object to the writer.</TD>
\r
217 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
\r
218 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
219 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
\r
220 <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TH>
\r
222 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
223 <TD><CODE><A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
\r
229 <!-- ========= CONSTRUCTOR DETAIL ======== -->
\r
231 <A NAME="constructor_detail"><!-- --></A>
\r
232 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
233 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
\r
234 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
\r
235 <B>Constructor Detail</B></FONT></TH>
\r
239 <A NAME="MarcStreamWriter(java.io.OutputStream)"><!-- --></A><H3>
\r
240 MarcStreamWriter</H3>
\r
242 public <B>MarcStreamWriter</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStream.html" title="class or interface in java.io">OutputStream</A> out)</PRE>
\r
244 <DD>Constructs an instance and creates a <code>Writer</code> object with
245 the specified output stream.
\r
250 <A NAME="MarcStreamWriter(java.io.OutputStream, java.lang.String)"><!-- --></A><H3>
\r
251 MarcStreamWriter</H3>
\r
253 public <B>MarcStreamWriter</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStream.html" title="class or interface in java.io">OutputStream</A> out,
\r
254 <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> encoding)</PRE>
\r
256 <DD>Constructs an instance and creates a <code>Writer</code> object with
257 the specified output stream and character encoding.
\r
261 <!-- ============ METHOD DETAIL ========== -->
\r
263 <A NAME="method_detail"><!-- --></A>
\r
264 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
265 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
\r
266 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
\r
267 <B>Method Detail</B></FONT></TH>
\r
271 <A NAME="getConverter()"><!-- --></A><H3>
\r
274 public <A HREF="../../org/marc4j/converter/CharConverter.html" title="class in org.marc4j.converter">CharConverter</A> <B>getConverter</B>()</PRE>
\r
276 <DD>Returns the character converter.
\r
279 <DT><B>Specified by:</B><DD><CODE><A HREF="../../org/marc4j/MarcWriter.html#getConverter()">getConverter</A></CODE> in interface <CODE><A HREF="../../org/marc4j/MarcWriter.html" title="interface in org.marc4j">MarcWriter</A></CODE></DL>
\r
283 <DT><B>Returns:</B><DD>CharConverter the character converter</DL>
\r
288 <A NAME="setConverter(org.marc4j.converter.CharConverter)"><!-- --></A><H3>
\r
291 public void <B>setConverter</B>(<A HREF="../../org/marc4j/converter/CharConverter.html" title="class in org.marc4j.converter">CharConverter</A> converter)</PRE>
\r
293 <DD>Sets the character converter.
\r
296 <DT><B>Specified by:</B><DD><CODE><A HREF="../../org/marc4j/MarcWriter.html#setConverter(org.marc4j.converter.CharConverter)">setConverter</A></CODE> in interface <CODE><A HREF="../../org/marc4j/MarcWriter.html" title="interface in org.marc4j">MarcWriter</A></CODE></DL>
\r
299 <DT><B>Parameters:</B><DD><CODE>converter</CODE> - the character converter</DL>
\r
304 <A NAME="write(org.marc4j.marc.Record)"><!-- --></A><H3>
\r
307 public void <B>write</B>(<A HREF="../../org/marc4j/marc/Record.html" title="interface in org.marc4j.marc">Record</A> record)</PRE>
\r
309 <DD>Writes a <code>Record</code> object to the writer.
\r
312 <DT><B>Specified by:</B><DD><CODE><A HREF="../../org/marc4j/MarcWriter.html#write(org.marc4j.marc.Record)">write</A></CODE> in interface <CODE><A HREF="../../org/marc4j/MarcWriter.html" title="interface in org.marc4j">MarcWriter</A></CODE></DL>
\r
315 <DT><B>Parameters:</B><DD><CODE>record</CODE> - -
316 the <code>Record</code> object</DL>
\r
321 <A NAME="close()"><!-- --></A><H3>
\r
324 public void <B>close</B>()</PRE>
\r
326 <DD>Closes the writer.
\r
329 <DT><B>Specified by:</B><DD><CODE><A HREF="../../org/marc4j/MarcWriter.html#close()">close</A></CODE> in interface <CODE><A HREF="../../org/marc4j/MarcWriter.html" title="interface in org.marc4j">MarcWriter</A></CODE></DL>
\r
335 <!-- ========= END OF CLASS DATA ========= -->
\r
339 <!-- ======= START OF BOTTOM NAVBAR ====== -->
\r
340 <A NAME="navbar_bottom"><!-- --></A>
\r
341 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
\r
342 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
\r
344 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
\r
345 <A NAME="navbar_bottom_firstrow"><!-- --></A>
\r
346 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
\r
347 <TR ALIGN="center" VALIGN="top">
\r
348 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
\r
349 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
\r
350 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
\r
351 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/MarcStreamWriter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
\r
352 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
\r
353 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
\r
354 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
\r
355 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
\r
359 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
\r
365 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
366 <A HREF="../../org/marc4j/MarcStreamReader.html" title="class in org.marc4j"><B>PREV CLASS</B></A>
\r
367 <A HREF="../../org/marc4j/MarcWriter.html" title="interface in org.marc4j"><B>NEXT CLASS</B></A></FONT></TD>
\r
368 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
369 <A HREF="../../index.html?org/marc4j/MarcStreamWriter.html" target="_top"><B>FRAMES</B></A>
\r
370 <A HREF="MarcStreamWriter.html" target="_top"><B>NO FRAMES</B></A>
\r
371 <SCRIPT type="text/javascript">
\r
374 document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
\r
379 <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
\r
386 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
387 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
\r
388 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
389 DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
\r
392 <A NAME="skip-navbar_bottom"></A>
\r
393 <!-- ======== END OF BOTTOM NAVBAR ======= -->
\r
396 Copyright © 2002-2006 Bas Peters. All Rights Reserved.
\r