public class MarcPermissiveStreamReader extends Object implements MarcReader
Example usage:
InputStream input = new FileInputStream("file.mrc");
MarcReader reader = new MarcPermissiveStreamReader(input, true, true);
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. Check the file org.marc4j.samples.PermissiveReaderExample.java for an example about using the
MarcPermissiveStreamReader in conjunction with the ErrorHandler class to report errors encountered while processing
records.
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. If the reader is operating in permissive mode and no encoding is given as an constructor argument the reader will look at the leader, and also at the data of the record to determine to the best of its ability what character encoding scheme has been used to encode the data in a particular MARC record.
| Constructor and Description |
|---|
MarcPermissiveStreamReader(InputStream input,
boolean permissive,
boolean convertToUTF8)
Constructs an instance with the specified input stream with possible additional functionality being enabled by
setting permissive and/or convertToUTF8 to true.
|
MarcPermissiveStreamReader(InputStream input,
boolean permissive,
boolean convertToUTF8,
String defaultEncoding)
Constructs an instance with the specified input stream with possible additional functionality being enabled by
setting permissive and/or convertToUTF8 to true.
|
MarcPermissiveStreamReader(InputStream input,
ErrorHandler errors,
boolean convertToUTF8)
Constructs an instance with the specified input stream with possible additional functionality being enabled by
passing in an ErrorHandler object and/or setting convertToUTF8 to true.
|
MarcPermissiveStreamReader(InputStream input,
ErrorHandler errors,
boolean convertToUTF8,
String defaultEncoding)
Constructs an instance with the specified input stream with possible additional functionality being enabled by
setting permissive and/or convertToUTF8 to true.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext()
Returns true if the iteration has more records, false otherwise.
|
boolean |
isTranslateLosslessUnicodeNumericCodeReferencesEnabled() |
Record |
next()
Returns the next record in the iteration.
|
void |
setTranslateLosslessUnicodeNumericCodeReferencesEnabled(boolean translateLosslessUnicodeNumericCodeReferencesEnabled)
Enable convesion of numeric code references into their corresponding code points when converting to unicode
|
public MarcPermissiveStreamReader(InputStream input, boolean permissive, boolean convertToUTF8)
public MarcPermissiveStreamReader(InputStream input, ErrorHandler errors, boolean convertToUTF8)
public MarcPermissiveStreamReader(InputStream input, boolean permissive, boolean convertToUTF8, String defaultEncoding)
public MarcPermissiveStreamReader(InputStream input, ErrorHandler errors, boolean convertToUTF8, String defaultEncoding)
public boolean isTranslateLosslessUnicodeNumericCodeReferencesEnabled()
public void setTranslateLosslessUnicodeNumericCodeReferencesEnabled(boolean translateLosslessUnicodeNumericCodeReferencesEnabled)
translateLosslessUnicodeNumericCodeReferencesEnabled - public boolean hasNext()
hasNext in interface MarcReaderpublic Record next()
next in interface MarcReaderCopyright © 2014 FreeLibrary. All Rights Reserved.