Class WritingStrategy.WritePartStrategy
- java.lang.Object
-
- net.stoerr.ai.aigenpipeline.framework.task.WritingStrategy.WritePartStrategy
-
- All Implemented Interfaces:
WritingStrategy
- Enclosing interface:
- WritingStrategy
public static class WritingStrategy.WritePartStrategy extends Object implements WritingStrategy
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.stoerr.ai.aigenpipeline.framework.task.WritingStrategy
WritingStrategy.WritePartStrategy
-
-
Field Summary
-
Fields inherited from interface net.stoerr.ai.aigenpipeline.framework.task.WritingStrategy
WITHOUTVERSION, WITHVERSION
-
-
Constructor Summary
Constructors Constructor Description WritePartStrategy(String marker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AIVersionMarkergetRecordedVersionMarker(File output)Find the first line of the file that contains the marker - that should also contain the version comment.StringtoString()voidwrite(File output, String content, String versionComment)Replaces the lines between the first line with marker and the second line with the marker with the content.
-
-
-
Constructor Detail
-
WritePartStrategy
public WritePartStrategy(String marker)
-
-
Method Detail
-
getRecordedVersionMarker
public AIVersionMarker getRecordedVersionMarker(@Nonnull File output) throws IOException
Find the first line of the file that contains the marker - that should also contain the version comment.- Specified by:
getRecordedVersionMarkerin interfaceWritingStrategy- Throws:
IOException
-
write
public void write(@Nonnull File output, @Nonnull String content, @Nonnull String versionComment) throws IOExceptionReplaces the lines between the first line with marker and the second line with the marker with the content. The first line should contain a version comment that is replaced by the new version comment. It is an error if the marker is not exactly twice in the output file.- Specified by:
writein interfaceWritingStrategy- Parameters:
output- the file to write to, has to existcontent- the content to writeversionComment- the version comment to write- Throws:
IOException- if the file cannot be read or written
-
-