1InputStream pdf = // greate some input stream data
2try (FileOutputStream outputStream = new FileOutputStream(new File("/Users/kirkbrown/documents/my.pdf"))) {
3
4 int read;
5 byte[] bytes = new byte[1024];
6
7 while ((read = pdf.read(bytes)) != -1) {
8 outputStream.write(bytes, 0, read);
9 }
10 }