java.lang.Object
edu.ntnu.idatt2001.paths.file.StoryFileWriter
Class for writing a story to a file.
- Version:
- 0.4 29.04.2023
- Author:
- Carl G. Callum G.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetFile()
Method to get the file.void
writeStory
(Story story) Method to write a story to a file.
-
Constructor Details
-
StoryFileWriter
public StoryFileWriter(File file) throws BadFileNameException, WrongFileExtensionException, NullPointerException Constructor for the class.- Parameters:
file
- File - the file to write to- Throws:
BadFileNameException
- thrown if the file name is invalidWrongFileExtensionException
- thrown if the file extension is invalidNullPointerException
- thrown if the file is null
-
-
Method Details
-
writeStory
Method to write a story to a file. Writes in the following format:StoryTitle ::PassageTitle PassageContent [LinkText](LinkReference)<Action1|Action2|...> ::PassageTitle PassageContent [LinkText](LinkReference)<Action1|Action2|...>
- Parameters:
story
- Story - the story to write- Throws:
IOException
- if an error occurs while writing to the file
-
getFile
Method to get the file.- Returns:
- File - the file
-