We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 35a4d2f commit cc24866Copy full SHA for cc24866
src/main/scala/introprog/IO.scala
@@ -49,6 +49,17 @@ object IO:
49
def saveLines(lines: Seq[String], fileName: String, enc: String = "UTF-8"): Unit =
50
saveString(lines.mkString("\n"), fileName, enc)
51
52
+ /**
53
+ * Appends `lines` to the text file `fileName` using encoding `enc`.
54
+ *
55
+ * @param lines the lines to append to the file.
56
+ * @param fileName the path of the file.
57
+ * @param enc the encoding of the file.
58
+ * */
59
+ def appendLines(lines: Seq[String], fileName: String, enc: String = "UTF-8"): Unit =
60
+ val newLines = loadLines(fileName, enc).appendedAll(lines)
61
+ saveLines(newLines, fileName, enc)
62
+
63
/**
64
* Load a serialized object from a binary file called `fileName`.
65
*
0 commit comments