Skip to content

Commit

Permalink
Make new ObjectFileWriter method available on ObjectWriter as wel…
Browse files Browse the repository at this point in the history
…l. (#475)
  • Loading branch information
blackwinter committed Nov 18, 2022
1 parent a9e94d3 commit e353e4b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions metafacture-io/src/main/java/org/metafacture/io/ObjectWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e353e4b

Please sign in to comment.