There are I/O classes that take the encoding as a parameter to the constructor.
For example see the OutputStreamWriter class.