org.marc4j
Class MarcDirStreamReader

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

public class MarcDirStreamReader
extends Object
implements MarcReader

A Marc reader which instead of handling a single file of MARC records it handles a directory, which it will scan for all .mrc files, and iterate through all of them in turn.

Version:
$Revision: 1.2 $
Author:
Robert Haschart

Constructor Summary
MarcDirStreamReader(File dir)
          Constructs an instance that traverses the directory specified in the parameter.
MarcDirStreamReader(File dir, boolean permissive, boolean convertToUTF8)
          Constructs an instance that traverses the directory specified in the parameter.
MarcDirStreamReader(File dir, boolean permissive, boolean convertToUTF8, String defaultEncoding)
          Constructs an instance that traverses the directory specified in the parameter.
MarcDirStreamReader(String dirName)
          Constructs an instance that traverses the directory specified in the parameter.
MarcDirStreamReader(String dirName, boolean permissive, boolean convertToUTF8)
          Constructs an instance that traverses the directory specified in the parameter.
MarcDirStreamReader(String dirName, boolean permissive, boolean convertToUTF8, String defaultEncoding)
          Constructs an instance that traverses the directory specified in the parameter.
 
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

MarcDirStreamReader

public MarcDirStreamReader(String dirName)
Constructs an instance that traverses the directory specified in the parameter.

Parameters:
dirName - - The path of the directory from which to read all of the .mrc files

MarcDirStreamReader

public MarcDirStreamReader(File dir)
Constructs an instance that traverses the directory specified in the parameter.

Parameters:
dir - - The path of the directory from which to read all of the .mrc files

MarcDirStreamReader

public MarcDirStreamReader(String dirName,
                           boolean permissive,
                           boolean convertToUTF8)
Constructs an instance that traverses the directory specified in the parameter. Takes the values passed in for permissive and convertToUTF8 and passes them on to each of the MarcPermissiveStreamReader that it creates.

Parameters:
dirName - - The path of the directory from which to read all of the .mrc files
permissive - - Set to true to specify that reader should try to handle and recover from errors in the input.
convertToUTF8 - - Set to true to specify that reader should convert the records being read to UTF-8 encoding as they are being read.

MarcDirStreamReader

public MarcDirStreamReader(File dir,
                           boolean permissive,
                           boolean convertToUTF8)
Constructs an instance that traverses the directory specified in the parameter. Takes the values passed in for permissive and convertToUTF8 and passes them on to each of the MarcPermissiveStreamReader that it creates.

Parameters:
dir - - The path of the directory from which to read all of the .mrc files
permissive - - Set to true to specify that reader should try to handle and recover from errors in the input.
convertToUTF8 - - Set to true to specify that reader should convert the records being read to UTF-8 encoding as they are being read.

MarcDirStreamReader

public MarcDirStreamReader(String dirName,
                           boolean permissive,
                           boolean convertToUTF8,
                           String defaultEncoding)
Constructs an instance that traverses the directory specified in the parameter. Takes the values passed in for permissive and convertToUTF8 and passes them on to each of the MarcPermissiveStreamReader that it creates.

Parameters:
dirName - - The path of the directory from which to read all of the .mrc files
permissive - - Set to true to specify that reader should try to handle and recover from errors in the input.
convertToUTF8 - - Set to true to specify that reader should convert the records being read to UTF-8 encoding as they are being read.
defaultEncoding - - Specifies the character encoding that the records being read are presumed to be in..

MarcDirStreamReader

public MarcDirStreamReader(File dir,
                           boolean permissive,
                           boolean convertToUTF8,
                           String defaultEncoding)
Constructs an instance that traverses the directory specified in the parameter. Takes the values passed in for permissive and convertToUTF8 and passes them on to each of the MarcPermissiveStreamReader that it creates.

Parameters:
dir - - The path of the directory from which to read all of the .mrc files
permissive - - Set to true to specify that reader should try to handle and recover from errors in the input.
convertToUTF8 - - Set to true to specify that reader should convert the records being read to UTF-8 encoding as they are being read.
defaultEncoding - - Specifies the character encoding that the records being read are presumed to be in..
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.