Skip to content

Commit e353e4b

Browse files
committed
Make new ObjectFileWriter method available on ObjectWriter as well. (#475)
1 parent a9e94d3 commit e353e4b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

metafacture-io/src/main/java/org/metafacture/io/ObjectFileWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public void closeStream() {
139139
* effective the next time a new output file is opened.
140140
*
141141
* @param appendIfFileExists true if new data should be appended,
142-
* false to overwrite the existing file.
142+
* false to overwrite the existing file
143143
*/
144144
public void setAppendIfFileExists(final boolean appendIfFileExists) {
145145
this.appendIfFileExists = appendIfFileExists;

metafacture-io/src/main/java/org/metafacture/io/ObjectWriter.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,20 @@ public void setSeparator(final String separator) {
128128
objectWriter.setSeparator(separator);
129129
}
130130

131+
/**
132+
* Controls whether to open files in append mode if they exist.
133+
*
134+
* @see ObjectFileWriter#setAppendIfFileExists
135+
*
136+
* @param appendIfFileExists true if new data should be appended,
137+
* false to overwrite the existing file
138+
*/
139+
public void setAppendIfFileExists(final boolean appendIfFileExists) {
140+
if (objectWriter instanceof ObjectFileWriter) {
141+
((ObjectFileWriter) objectWriter).setAppendIfFileExists(appendIfFileExists);
142+
}
143+
}
144+
131145
@Override
132146
public void process(final T obj) {
133147
objectWriter.process(obj);

0 commit comments

Comments
 (0)