Can work on file given in argument
authorDennis Schafroth <dennis@indexdata.com>
Tue, 3 Jan 2012 20:39:32 +0000 (21:39 +0100)
committerDennis Schafroth <dennis@indexdata.com>
Tue, 3 Jan 2012 20:39:32 +0000 (21:39 +0100)
src/org/marc4j/samples/Marc8ToMarcXmlExample.java

index eba9cfe..9bf6b06 100644 (file)
@@ -20,7 +20,8 @@
  */\r
 package org.marc4j.samples;\r
 \r
-import java.io.FileOutputStream;\r
+import java.io.File;\r
+import java.io.FileInputStream;\r
 import java.io.InputStream;\r
 import java.io.OutputStream;\r
 \r
@@ -40,11 +41,14 @@ import org.marc4j.marc.Record;
 public class Marc8ToMarcXmlExample {\r
 \r
     public static void main(String args[]) throws Exception {\r
+      InputStream input; \r
+        if (args.length > 0) \r
+          input = new FileInputStream(new File(args[0]));\r
+        else \r
+          input = ReadMarcExample.class\r
+               .getResourceAsStream("resources/brkrtest.mrc");\r
 \r
-        InputStream input = ReadMarcExample.class\r
-                .getResourceAsStream("resources/brkrtest.mrc");\r
-\r
-        OutputStream out = new FileOutputStream("c:/temp/summerland.xml");\r
+        OutputStream out = System.out;\r
 \r
         MarcReader reader = new MarcStreamReader(input);\r
         MarcWriter writer = new MarcXmlWriter(out, true);\r