add MARCRecord convenience method for instantiating from input stream
This commit is contained in:
parent
375afbd85d
commit
cacf1e5b05
2 changed files with 8 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
group = org.xbib
|
group = org.xbib
|
||||||
name = marc
|
name = marc
|
||||||
version = 2.9.13
|
version = 2.9.14
|
||||||
|
|
||||||
org.gradle.warning.mode = ALL
|
org.gradle.warning.mode = ALL
|
||||||
|
|
|
@ -19,7 +19,9 @@ import static org.xbib.marc.json.MarcJsonWriter.FORMAT_TAG;
|
||||||
import static org.xbib.marc.json.MarcJsonWriter.LEADER_TAG;
|
import static org.xbib.marc.json.MarcJsonWriter.LEADER_TAG;
|
||||||
import static org.xbib.marc.json.MarcJsonWriter.TYPE_TAG;
|
import static org.xbib.marc.json.MarcJsonWriter.TYPE_TAG;
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
import java.io.InputStream;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import org.xbib.marc.label.RecordLabel;
|
import org.xbib.marc.label.RecordLabel;
|
||||||
|
|
||||||
|
@ -134,6 +136,10 @@ public class MarcRecord implements Map<String, Object> {
|
||||||
return marcRecord;
|
return marcRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Iterable<MarcRecord> from(InputStream inputStream, Charset charset) {
|
||||||
|
return Marc.builder().setInputStream(inputStream).setCharset(charset).iterable();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the MARC record format.
|
* Return the MARC record format.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue