Update Reader.scala
This commit is contained in:
parent
96927642c1
commit
a4fbb2d7f1
|
@ -8,7 +8,7 @@ object Reader {
|
||||||
/** Read file with the name specified in parameter */
|
/** Read file with the name specified in parameter */
|
||||||
def readList(filename: String): List[String] =
|
def readList(filename: String): List[String] =
|
||||||
{
|
{
|
||||||
val src = Source.fromFile(getClass.getResource("/input1.txt").getFile)
|
val src = Source.fromFile(getClass.getResource(filename).getFile)
|
||||||
val list = src.getLines().toList
|
val list = src.getLines().toList
|
||||||
src.close()
|
src.close()
|
||||||
list
|
list
|
||||||
|
@ -17,7 +17,7 @@ object Reader {
|
||||||
/** Read file with the name specified in parameter */
|
/** Read file with the name specified in parameter */
|
||||||
def readArray(filename: String): Array[String] =
|
def readArray(filename: String): Array[String] =
|
||||||
{
|
{
|
||||||
val src = Source.fromFile(getClass.getResource("/input1.txt").getFile)
|
val src = Source.fromFile(getClass.getResource(filename).getFile)
|
||||||
val array = src.getLines().toArray
|
val array = src.getLines().toArray
|
||||||
src.close()
|
src.close()
|
||||||
array
|
array
|
||||||
|
@ -26,7 +26,7 @@ object Reader {
|
||||||
/** Read file with the name specified in parameter */
|
/** Read file with the name specified in parameter */
|
||||||
def readString(filename: String): String =
|
def readString(filename: String): String =
|
||||||
{
|
{
|
||||||
val src = Source.fromFile(getClass.getResource("/input1.txt").getFile)
|
val src = Source.fromFile(getClass.getResource(filename).getFile)
|
||||||
val string = src.getLines().mkString
|
val string = src.getLines().mkString
|
||||||
src.close()
|
src.close()
|
||||||
string
|
string
|
||||||
|
|
Loading…
Reference in a new issue