use PrintStream for output, substitute for DataOutputStream.