public OutputStream openBinary(JPackage pkg, String fileName) throws IOException {
   Filer.Location loc;
   if (fileName.endsWith(".java")) {
     // APT doesn't do the proper Unicode escaping on Java source files,
     // so we can't rely on Filer.createSourceFile.
     loc = SOURCE_TREE;
   } else {
     // put non-Java files directly to the output folder
     loc = CLASS_TREE;
   }
   return filer.createBinaryFile(loc, pkg.name(), new File(fileName));
 }