Package javax.tools

Examples of javax.tools.FileObject.openWriter()


      // File not found, create a new one...
      FileObject  fo = processingEnv.getFiler().createResource(
          StandardLocation.CLASS_OUTPUT,
          "",
          FACTORY_FILE);
      _writer = new PrintWriter(fo.openWriter());
      return _writer;
    }
    return _writer;
  }
View Full Code Here


      // File not found, create a new one...
      FileObject  fo = processingEnv.getFiler().createResource(
          StandardLocation.CLASS_OUTPUT,
          "",
          FACTORY_FILE);
      _writer = new PrintWriter(fo.openWriter());
      return _writer;
    }
    return _writer;
  }
View Full Code Here

            {
                FileObject resource =
                    filer.createResource( StandardLocation.SOURCE_OUTPUT, packageElement.getQualifiedName(), name
                        + ".txt", element );

                Writer writer = resource.openWriter();
                writer.write( name.toString() );
                writer.close();
            }
            catch ( IOException e )
            {
View Full Code Here

              public void createResource(Path.Absolute path, CharSequence content) throws IOException {
                FileKey key = FileKey.newName(path);
                FileObject scriptFile = owner.application.getProcessingContext().createResource(StandardLocation.CLASS_OUTPUT, key, elements);
                Writer writer = null;
                try {
                  writer = scriptFile.openWriter();
                  writer.append(content);
                  log.info("Generated template script " + path.getCanonical() + " as " + scriptFile.toUri() +
                      " with originating elements " + Arrays.asList(elements));
                }
                finally {
View Full Code Here

    } else {
      Path.Absolute resolvedPath = owner.resolvePath(path);
      Writer writer = null;
      try {
        FileObject classFile = owner.application.getProcessingContext().createSourceFile(resolvedPath.getName(), elements);
        writer = classFile.openWriter();
        emitClass(provider, template, elements, writer);
        classCache.put(path, classFile);
        log.info("Generated template class " + path + " as " + classFile.toUri() +
            " with originating elements " + Arrays.asList(elements));
      }
View Full Code Here

    // Emit descriptor
    if (descriptor != null) {
      Writer writer = null;
      try {
        FileObject fo = env.createResource(StandardLocation.CLASS_OUTPUT, "juzu", "config.json");
        writer = fo.openWriter();
        descriptor.toString(writer, 2);
      }
      catch (IOException e) {
        throw ApplicationMetaModel.CANNOT_WRITE_CONFIG.failure(e);
      }
View Full Code Here

        //
        Writer writer = null;
        try {
          FileObject fo = metaModel.processingContext.createResource(StandardLocation.CLASS_OUTPUT, application.getName(), "config.json");
          writer = fo.openWriter();
          descriptor.toString(writer, 2);
        }
        catch (IOException e) {
          throw ApplicationMetaModel.CANNOT_WRITE_APPLICATION_CONFIG.failure(e, metaModel.processingContext.get(application.getHandle()), application.getName());
        }
View Full Code Here

          if (result instanceof Compilation) {
            try {
              log.info("Resource " + resource + " compiled about to write on disk as " + to);
              Compilation compilation = (Compilation)result;
              FileObject fo = env.createResource(StandardLocation.CLASS_OUTPUT, to);
              Writer writer = fo.openWriter();
              try {
                writer.write(compilation.getValue());
              }
              finally {
                Tools.safeClose(writer);
View Full Code Here

        if (roundEnv.processingOver()) {
            try {
                collated.append("</module>");
                FileObject f = processingEnv.getFiler().createResource(StandardLocation.SOURCE_OUTPUT,
                        "com.bramosystems.oss.player.core", "AutoInjected.gwt.xml");
                f.openWriter().append(collated).close();
            } catch (IOException ex) {
                Logger.getLogger(InjectionProcessor.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        return true;
View Full Code Here

  }

  private void write(Set<String> entries) {
    try {
      FileObject file = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", EXTENSIONS_RESOURCE);
      Writer writer = file.openWriter();
      for (String entry : entries) {
        writer.write(entry);
        writer.write("\n");
      }
      writer.close();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.