I'm curious what is the best way to do this. I'm playing around with writing some library functions (to implement part of FTP, mostly out of interest) and there is a certain amount of text generated both in the form of sending commands and receiving responses from the server. Since I'm trying to make this code as reusable as possible it is printed by a function of mine and I want to be able to specify where the output should go. Currently I pass in a PrintStream object to be printed to (such as System.out for debuging or null if you don't want it to print). Is this the best way to do it? Is there a better class to use than PrintStream?