What do you mean by "doesn't work"?

From the PrintWriter API, there's no constructor which will create a PrintWriter from just a file, you must have an OutputStream.

inputStream = new...