Skip to content

Commit

Permalink
issue #113: Reading MARCMaker format
Browse files Browse the repository at this point in the history
  • Loading branch information
pkiraly committed Dec 13, 2021
1 parent 4e69d1c commit c3b4b22
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,15 @@ public void start() {
logger.info("marcVersion: " + marcVersion.getCode() + ", " + marcVersion.getLabel());

if (parameters.getDataSource().equals(DataSource.FILE)) {
logger.info("process file");
String[] inputFileNames = processor.getParameters().getArgs();
for (String inputFileName : inputFileNames) {
if (!processor.readyToProcess())
break;
processFile(inputFileName);
}
} else if (parameters.getDataSource().equals(DataSource.STREAM)) {
logger.info("process stream");
try {
MarcReader reader = getMarcStreamReader(processor.getParameters());
logger.info("reader: " + reader.getClass().getCanonicalName());
processContent(reader, "stream");
} catch (Exception e) {
e.printStackTrace();
Expand All @@ -97,7 +94,6 @@ private void processFile(String inputFileName) {
try {
processor.fileOpened(path);
MarcReader reader = getMarcFileReader(processor.getParameters(), path);
logger.info("processFile() reader: " + reader.getClass().getCanonicalName());
processContent(reader, fileName);
if (processor.getParameters().doLog())
logger.info(String.format("Finished processing file. Processed %s records.", decimalFormat.format(i)));
Expand Down Expand Up @@ -185,7 +181,6 @@ private MarcReader getMarcFileReader(CommonParameters parameters, Path path) thr
}

private MarcReader getMarcStreamReader(CommonParameters parameters) throws Exception {
logger.info(String.format("getMarcStreamReader - format %s", parameters.getMarcFormat()));
return ReadMarc.getStreamReader(parameters.getMarcFormat(), parameters.getStream(), parameters.getDefaultEncoding());
}

Expand Down
4 changes: 0 additions & 4 deletions src/main/java/de/gwdg/metadataqa/marc/utils/ReadMarc.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

public class ReadMarc {

private static final Logger logger = Logger.getLogger(ReadMarc.class.getCanonicalName());

public static List<Record> read(String fileName) throws Exception {
return read(fileName, null);
}
Expand Down Expand Up @@ -130,7 +127,6 @@ public static MarcReader getStreamReader(MarcFormat marcFormat, InputStream stre
}

public static MarcReader getStreamReader(MarcFormat marcFormat, InputStream stream, String encoding) throws Exception {
logger.info(String.format("MarcReader.getMarcStreamReader - format %s", marcFormat));
MarcReader reader = null;
switch (marcFormat) {
case ALEPHSEQ:
Expand Down

0 comments on commit c3b4b22

Please sign in to comment.