aspose file tools
The moose likes Beginning Java and the fly likes OOP Passing parameter back Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "OOP Passing parameter back" Watch "OOP Passing parameter back" New topic
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
    
  10

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?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OOP Passing parameter back
 
Similar Threads
error while reading objects from file
Log events to a file
java.util.Logger creating multiple log files
HTTP method GET is not supported by this URL
Getting Different File Sizes from the server.