Compdigitec Labs

« | Home | »

Getting files from sources in Scala

By admin | February 14, 2021

// Java-based ways
getClass.getResource("/html/myfile.html")
println(Source.fromInputStream(getClass.getResourceAsStream("/html/myfile.html")).mkString)

// Scala-native way
// Note: NO LEADING SLASH
println(Source.fromResource("html/myfile.html").getLines.toList)

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

Topics: Code | 31 Comments »

31 Responses to “Getting files from sources in Scala”

  1. รูปแบบเกมบนเว็บ BetGames Says:
    January 6th, 2024 at 18:24

    … [Trackback]

    […] Find More here to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  2. aksara178 Says:
    January 7th, 2024 at 04:55

    … [Trackback]

    […] Info on that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  3. therapist suffolk county Says:
    January 7th, 2024 at 18:08

    … [Trackback]

    […] Find More Information here to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  4. บุหรี่นอก Says:
    January 7th, 2024 at 19:02

    … [Trackback]

    […] There you will find 88470 more Information on that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  5. https://ayo.insaf.pk/ Says:
    January 8th, 2024 at 11:26

    … [Trackback]

    […] There you can find 50806 additional Information to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  6. bonanza178 Says:
    January 8th, 2024 at 15:02

    … [Trackback]

    […] Info on that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  7. uv dtf foil Says:
    January 8th, 2024 at 18:10

    … [Trackback]

    […] Read More here on that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  8. more Says:
    January 9th, 2024 at 05:46

    … [Trackback]

    […] Information to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  9. เล่น YGGDRASIL ผ่านเว็บตรงสล็อต Lsm99live Says:
    January 9th, 2024 at 19:01

    … [Trackback]

    […] Read More here to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  10. czgunshopcenter Says:
    January 10th, 2024 at 08:33

    … [Trackback]

    […] Find More on that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  11. ดูหนังเต็มเรื่อง Says:
    January 10th, 2024 at 18:30

    … [Trackback]

    […] Read More Information here to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  12. 10 ข้อดีของการ สมัครสล็อต true wallet กับ LSM99 Says:
    January 10th, 2024 at 19:50

    … [Trackback]

    […] Find More on that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  13. aia health saver Says:
    January 10th, 2024 at 20:19

    … [Trackback]

    […] Read More Info here on that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  14. บริการเปิดบริษัท Says:
    January 11th, 2024 at 02:27

    … [Trackback]

    […] Read More to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  15. ชีทราม Says:
    January 11th, 2024 at 18:25

    … [Trackback]

    […] There you can find 84540 more Info on that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  16. บาคาร่าเล่นยังไง Says:
    January 11th, 2024 at 18:38

    … [Trackback]

    […] Find More Information here to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  17. เช็คคนโกง Says:
    January 11th, 2024 at 20:03

    … [Trackback]

    […] Read More to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  18. Design Says:
    January 12th, 2024 at 15:17

    … [Trackback]

    […] Find More on on that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  19. ทำไมต้องเลือกเล่นเดิมพัน Luckyniki88 ลัคกี้นิกิ88 Says:
    January 12th, 2024 at 18:33

    … [Trackback]

    […] Here you will find 998 more Information to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  20. แนะนําเว็บสล็อต แตกง่าย 2024 Says:
    January 12th, 2024 at 19:09

    … [Trackback]

    […] Find More on that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  21. ผู้ช่วยพยาบาล Says:
    January 12th, 2024 at 20:05

    … [Trackback]

    […] Here you can find 7322 more Info on that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  22. ร้านอาหารแถวพัฒนาการ Says:
    January 12th, 2024 at 20:47

    … [Trackback]

    […] Read More to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  23. ตี๋น้อย 168 มีอะไรให้คุณได้เลือกเดิมพันบ้าง ? Says:
    January 13th, 2024 at 19:57

    … [Trackback]

    […] Read More on to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  24. บับเบิ้ล กันกระแทก Says:
    February 1st, 2024 at 00:41

    … [Trackback]

    […] Find More on to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  25. upx1688 Says:
    February 4th, 2024 at 18:20

    … [Trackback]

    […] Read More to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  26. https://hmcazinourimoldova.com/casino/frank-casino-review Says:
    February 14th, 2024 at 18:09

    … [Trackback]

    […] Find More here to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  27. สล็อตวอเลท Says:
    February 15th, 2024 at 18:24

    … [Trackback]

    […] There you can find 31051 more Info to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  28. สล็อตเว็บตรง Says:
    February 16th, 2024 at 20:48

    … [Trackback]

    […] Find More Info here to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  29. Slot Gacor Says:
    February 17th, 2024 at 11:06

    … [Trackback]

    […] Information to that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  30. https://slingomama74.bbeasy.ru/viewtopic.php?id=3613 Says:
    February 20th, 2024 at 18:11

    … [Trackback]

    […] Here you can find 75124 more Information on that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

  31. เสื้อสูทผู้หญิง Says:
    February 20th, 2024 at 19:08

    … [Trackback]

    […] Read More Info here on that Topic: compdigitec.com/labs/2021/02/14/getting-files-from-sources-in-scala/ […]

Comments