org.marc4j
Class MarcStreamReader

java.lang.Object
  extended by org.marc4j.MarcStreamReader
All Implemented Interfaces:
MarcReader

public class MarcStreamReader
extends Object
implements MarcReader

An iterator over a collection of MARC records in ISO 2709 format.

Example usage:

 InputStream input = new FileInputStream("file.mrc");
 MarcReader reader = new MarcStreamReader(input);
 while (reader.hasNext()) {
     Record record = reader.next();
     // Process record
 }
 

Check the org.marc4j.marc package for examples about the use of the Record object model.

When no encoding is given as an constructor argument the parser tries to resolve the encoding by looking at the character coding scheme (leader position 9) in MARC21 records. For UNIMARC records this position is not defined.

Version:
$Revision: 1.11 $
Author:
Bas Peters

Constructor Summary
MarcStreamReader(InputStream input)
          Constructs an instance with the specified input stream.
MarcStreamReader(InputStream input, String encoding)
          Constructs an instance with the specified input stream.
 
Method Summary
 boolean hasNext()
          Returns true if the iteration has more records, false otherwise.
 Record next()
          Returns the next record in the iteration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MarcStreamReader

public MarcStreamReader(InputStream input)
Constructs an instance with the specified input stream.


MarcStreamReader

public MarcStreamReader(InputStream input,
                        String encoding)
Constructs an instance with the specified input stream.

Method Detail

hasNext

public boolean hasNext()
Returns true if the iteration has more records, false otherwise.

Specified by:
hasNext in interface MarcReader

next

public Record next()
Returns the next record in the iteration.

Specified by:
next in interface MarcReader
Returns:
Record - the record object


Copyright © 2002-2006 Bas Peters. All Rights Reserved.