diff --git a/metafacture-io/src/main/java/org/metafacture/io/ObjectFileWriter.java b/metafacture-io/src/main/java/org/metafacture/io/ObjectFileWriter.java index edbcc72f0..7e6003cf7 100644 --- a/metafacture-io/src/main/java/org/metafacture/io/ObjectFileWriter.java +++ b/metafacture-io/src/main/java/org/metafacture/io/ObjectFileWriter.java @@ -139,7 +139,7 @@ public void closeStream() { * effective the next time a new output file is opened. * * @param appendIfFileExists true if new data should be appended, - * false to overwrite the existing file. + * false to overwrite the existing file */ public void setAppendIfFileExists(final boolean appendIfFileExists) { this.appendIfFileExists = appendIfFileExists; diff --git a/metafacture-io/src/main/java/org/metafacture/io/ObjectWriter.java b/metafacture-io/src/main/java/org/metafacture/io/ObjectWriter.java index 6ce1c4436..f7add1b94 100644 --- a/metafacture-io/src/main/java/org/metafacture/io/ObjectWriter.java +++ b/metafacture-io/src/main/java/org/metafacture/io/ObjectWriter.java @@ -128,6 +128,20 @@ public void setSeparator(final String separator) { objectWriter.setSeparator(separator); } + /** + * Controls whether to open files in append mode if they exist. + * + * @see ObjectFileWriter#setAppendIfFileExists + * + * @param appendIfFileExists true if new data should be appended, + * false to overwrite the existing file + */ + public void setAppendIfFileExists(final boolean appendIfFileExists) { + if (objectWriter instanceof ObjectFileWriter) { + ((ObjectFileWriter) objectWriter).setAppendIfFileExists(appendIfFileExists); + } + } + @Override public void process(final T obj) { objectWriter.process(obj);