Reputation: 5659
I'm trying to read in a .torrent file with the following code:
val source = scala.io.Source.fromFile(filename, "utf-8")
val lines = source.mkString
source.close()
But when I run my program I get the following exception:
Exception in thread "main" java.nio.charset.MalformedInputException: Input length = 1
I have tried putting no charset and get the same issue.
What is the problem and what should the charset be for reading a .torrent file?
Upvotes: 0
Views: 1394
Reputation: 62835
Torrent file is not plain text file, but rather has binary structure. Use appropriate library to decode them
Upvotes: 2