On Tue, Mar 27, 2012 at 7:32 PM, echo <[email protected]> wrote: >> >> IIRC, the reason why Readers and Writers were used is that they fix a >> host of character encoding issues. From what I remember when I was >> working on the Java port, there were some problems with accented >> characters getting garbled during processing if something more >> lightweight was used. >> >> -- Stephen >> > > All right, thank you for the words from what I've got the encoding stuff. > And do you think it is realistic to implement pipeline section by another > method, e.g., only String object, on mobile like Android?
Well, another reason why readers and writers were chosen, is that allows the various components in the pipeline to also be called on their own if necessary/desired. When in pipeline mode, the Readers and Writers (except for initial reader and final writer) are all String-backed (StringReader and StringWriter). When not in pipeline mode, the reader is stdin and the writer is stdout, unless alternate files are provided on the command line. Unfortunately, StringReader and StringWriter objects can't be reset to new strings once they have been created, so when passing strings from the output of one component to the input of another, a new StringReader needs to be created from the contents of the previous StringWriter, and a new StringWriter needs to be created for that component to write to. (See org.apertium.pipeline.ApertiumMain.java, lines 208 through 235.) -- Stephen ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ Apertium-stuff mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/apertium-stuff
