| Author |
OOP Passing parameter back
|
Roberto Gonsales
Greenhorn
Joined: Sep 26, 2011
Posts: 5
|
|
Hello everybody, I need some help. I'm writing program which takes bunch of text files with different charset encoding and converts these files to another one charset. My program is almost done, but one key thing. How do I pass 'charset' parameter of Notify method in CharsetDetector class back to Converter class?
|
 |
Greg Charles
Bartender
Joined: Oct 01, 2001
Posts: 2542
|
|
I'm not clear on when or why your notify() method is called, but I think the most logical way to get the results of detectCharset() into your converter would be to return it from detectCharset().
A couple of extra suggestions:
1. Wrap your reader and writer in BufferedReader and BufferedWriter and you'll see a dramatic increase in performance.
2. Learn the capitalization conventions for Java. Classes and Interfaces should start with a capital. Methods and variables start with lowercase. Following conventions like these make your code much more readable.
|
 |
Roberto Gonsales
Greenhorn
Joined: Sep 26, 2011
Posts: 5
|
|
Greg, thank you for reply. I changed code in accordance with your recommendations to use BufferedReader and BufferedWriter.
Interface nsICharsetDetectionObserver is part of jChardet library. nsDetector fires the Notify() method between nsDetector.DoIt() and nsDetector.DataEnd() calls. I changed CharsetDetector class to get result only in Notify() method. So how do I get the result back to Converter class?
|
 |
 |
|
|
subject: OOP Passing parameter back
|
|
|