- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Another newbie question
Sat, 2009-12-12, 18:52
Hello all,
Is there any way of doing in Scala something similar as the functionality provided by the Java classes: "Scanner" and "StreamTokenizer"??
Regards,
Pedro
Is there any way of doing in Scala something similar as the functionality provided by the Java classes: "Scanner" and "StreamTokenizer"??
Regards,
Pedro
Sun, 2009-12-13, 01:07
#2
Re: Another newbie question
Hi Kevin. Thanks for your interest on this question.
I'm trying to translate some Java packages to Scala for practicing reasons. If it works OK (if I manage to succeed with Scala ;-), I'll migrate the whole Java application to Scala.
At present, the task is performing data conversion from formated (using different data types) text input files to XML (output file).
From answers received to a previous message, I'll keep the File-IO part of the code in Java.
Once I get the "data stream" from input-file, I need to "analyze" the data read ("tokenize" the stream, read each token according to its source type and asign the result to some XML structure).
Now the question is:
Could I begin using Scala in order to "analyze" the data read from files, or I still have to stick to Java using "StreamTokenizer" class (for example) for this purpose??
Regards.
Pedro
2009/12/12 Kevin Wright <kev.lee.wright@googlemail.com>
I'm trying to translate some Java packages to Scala for practicing reasons. If it works OK (if I manage to succeed with Scala ;-), I'll migrate the whole Java application to Scala.
At present, the task is performing data conversion from formated (using different data types) text input files to XML (output file).
From answers received to a previous message, I'll keep the File-IO part of the code in Java.
Once I get the "data stream" from input-file, I need to "analyze" the data read ("tokenize" the stream, read each token according to its source type and asign the result to some XML structure).
Now the question is:
Could I begin using Scala in order to "analyze" the data read from files, or I still have to stick to Java using "StreamTokenizer" class (for example) for this purpose??
Regards.
Pedro
2009/12/12 Kevin Wright <kev.lee.wright@googlemail.com>
What are you trying to do exactly?
A functional approach using for/yield or map/flatmap/filter would probably be better...
On Sat, Dec 12, 2009 at 5:52 PM, Pedro Pastor <ppsppg@gmail.com> wrote:
Hello all,
Is there any way of doing in Scala something similar as the functionality provided by the Java classes: "Scanner" and "StreamTokenizer"??
Regards,
Pedro
Sun, 2009-12-13, 01:17
#3
Re: Another newbie question
On Sat, Dec 12, 2009 at 4:01 PM, Pedro Pastor wrote:
>
> Once I get the "data stream" from input-file, I need to "analyze" the data
> read ("tokenize" the stream, read each token according to its source type
> and asign the result to some XML structure).
>
> Now the question is:
> Could I begin using Scala in order to "analyze" the data read from files, or
> I still have to stick to Java using "StreamTokenizer" class (for example)
> for this purpose??
Take a look at Scala's parser combinator libraries. In particular:
http://www.scala-lang.org/docu/files/api/scala/util/parsing/combinator/l...
A functional approach using for/yield or map/flatmap/filter would probably be better...
On Sat, Dec 12, 2009 at 5:52 PM, Pedro Pastor <ppsppg@gmail.com> wrote: