I want to read .doc file in scala. I tried using apache.poi library for this but the method HWPFDocument(java.io.InputStream istream) accepts java io stream. If anyone can shed some light on this, that would great!
Asked
Active
Viewed 318 times
2 Answers
2
So, here is a teaser to get you started:
val fis = new FileInputStream("/path/to/file/doc.doc")
val doc = new HWPFDocument(fis)
val we = new WordExtractor(doc)
val paras = we.getParagraphText()

joesan
- 13,963
- 27
- 95
- 232
0
You can use InputStream
in Scala, just as any other Java class/interface.

Alexey Romanov
- 167,066
- 35
- 309
- 487
-
I am new to scala. I thought scala have some alternative for InputStream. – Priyanka Apr 01 '16 at 08:45
-
Even when Scala does provide alternatives to classes/interfaces in standard Java libraries, they are just this: alternatives. You can still use the Java classes. And you have to when working with Java libraries which use them. – Alexey Romanov Apr 01 '16 at 09:00