@Override public BinFileInput<T> getInput() throws IOException { return new BinFileInput<>(dstPath); }
@Override public void reset() throws IOException { if(itemsSrc != null) { itemsSrc.close(); } setItemsSrc(buildObjectInputStream(srcPath)); } }
/** @param srcPath the path to the file which should be used to restore the serialized items @throws IOException if unable to open the file for reading */ public BinFileInput(final Path srcPath) throws IOException { super(buildObjectInputStream(srcPath)); this.srcPath = srcPath; }
static <I extends Item> Input<I> createFileItemInput( final ItemFactory<I> itemFactory, final String itemInputFile) { Input<I> fileItemInput = null; final Path itemInputFilePath = Paths.get(itemInputFile); try { if (itemInputFile.endsWith(".csv")) { try { fileItemInput = new CsvFileItemInput<>(itemInputFilePath, itemFactory); } catch (final NoSuchMethodException e) { throw new AssertionError(e); } } else { fileItemInput = new BinFileInput<>(itemInputFilePath); } } catch (final IOException e) { LogUtil.exception(Level.WARN, e, "Failed to open the item input file \"{}\"", itemInputFile); } return fileItemInput; }