Java Code Examples for javax.tools.ForwardingJavaFileObject

The following examples show how to use javax.tools.ForwardingJavaFileObject. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public JavaFileObject getJavaFileForOutput(Location location, String className, javax.tools.JavaFileObject.Kind kind, final FileObject sibling) throws IOException {
  JavaFileObject fileObject = super.getJavaFileForOutput(location, className, kind, sibling);
  return new ForwardingJavaFileObject<JavaFileObject>(fileObject) {
    @Override
    public OutputStream openOutputStream() throws IOException {
      record(sibling != null ? FileObjects.toFile(sibling) : null, FileObjects.toFile(fileObject));
      return new IncrementalFileOutputStream(FileObjects.toFile(this));
    }

    @Override
    public Writer openWriter() throws IOException {
      return encoding != null ? new OutputStreamWriter(openOutputStream(), encoding) : new OutputStreamWriter(openOutputStream());
    }
  };
}