Package javax.tools

Examples of javax.tools.FileObject


  OutputStream getConfigOutputStream() throws IOException {
    if (configOutputStream != null) {
      return configOutputStream;
    }
    Filer filer = processingEnv.getFiler();
    FileObject fileObject =
        filer.createResource(StandardLocation.CLASS_OUTPUT, "", CALLBACKS_CONFIG_FILE);
    return fileObject.openOutputStream();
  }
View Full Code Here


            }
        }
    }

    private void writeCacheFile(final Element... elements) throws IOException {
        final FileObject fo = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT,
            Strings.EMPTY, PLUGIN_CACHE_FILE, elements);
        final OutputStream out = fo.openOutputStream();
        try {
            pluginCache.writeCache(out);
        } finally {
            out.close();
        }
View Full Code Here

    if (relativeName.endsWith(JavaUtils.HELPER_CLASS_SUFFIX)) {
      relativeName += Kind.CLASS.extension;
    } else {
      relativeName += JavaUtils.CONTRACTS_EXTENSION;
    }
    FileObject file =
        fileManager.getFileForOutput(location,
                                     ClassName.getPackageName(className),
                                     relativeName, sibling);
    return new SimpleOutputJavaFileObject(binaryName, file);
  }
View Full Code Here

   */
  @Override
  public void init(ProcessingEnvironment processingEnv) {
    super.init(processingEnv);
    try {
      FileObject manifest = processingEnv.getFiler()
          .createResource(StandardLocation.SOURCE_OUTPUT, "", "bugPatterns.txt");
      pw = new PrintWriter(new OutputStreamWriter(manifest.openOutputStream()));
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

          }

          if (createBaseAndSubclass) {
            code = code.replaceFirst("(Ext.define\\([\"'].+?)([\"'],)",
                "$1Base$2");
            FileObject fo = processingEnv.getFiler().createResource(
                StandardLocation.SOURCE_OUTPUT, packageName,
                fileName + "Base.js");
            OutputStream os = fo.openOutputStream();
            os.write(code.getBytes(ModelGenerator.UTF8_CHARSET));
            os.close();

            try {
              fo = processingEnv.getFiler().getResource(
                  StandardLocation.SOURCE_OUTPUT, packageName,
                  fileName + ".js");
              InputStream is = fo.openInputStream();
              is.close();
            }
            catch (FileNotFoundException e) {
              String subClassCode = generateSubclassCode(modelClass,
                  outputConfig);
              fo = processingEnv.getFiler().createResource(
                  StandardLocation.SOURCE_OUTPUT, packageName,
                  fileName + ".js");
              os = fo.openOutputStream();
              os.write(subClassCode.getBytes(ModelGenerator.UTF8_CHARSET));
              os.close();
            }

          }
          else {
            FileObject fo = processingEnv.getFiler().createResource(
                StandardLocation.SOURCE_OUTPUT, packageName,
                fileName + ".js");
            OutputStream os = fo.openOutputStream();
            os.write(code.getBytes(ModelGenerator.UTF8_CHARSET));
            os.close();
          }

        }
View Full Code Here

     }
   }

   private void clearOldVersions(final String packageName, final String fileName) {
     try {
       FileObject schema = processingEnv.getFiler().getResource(StandardLocation.SOURCE_OUTPUT, packageName, fileName);
       String schemaFile = schema.toUri().toASCIIString();
       String withoutFile = schemaFile.replace("file:", "") + ".java";
       if (new File(withoutFile).exists()) {
         new File(withoutFile).delete();
       }
     } catch (IOException e) {
View Full Code Here

          }

          if (createBaseAndSubclass) {
            code = code.replaceFirst(
                "(Ext.define\\([\"'].+?)([\"'],)", "$1Base$2");
            FileObject fo = processingEnv.getFiler()
                .createResource(StandardLocation.SOURCE_OUTPUT,
                    packageName, fileName + "Base.js");
            OutputStream os = fo.openOutputStream();
            os.write(code.getBytes(ModelGenerator.UTF8_CHARSET));
            os.close();

            try {
              fo = processingEnv.getFiler().getResource(
                  StandardLocation.SOURCE_OUTPUT,
                  packageName, fileName + ".js");
              InputStream is = fo.openInputStream();
              is.close();
            }
            catch (FileNotFoundException e) {
              String subClassCode = generateSubclassCode(
                  modelClass, outputConfig);
              fo = processingEnv.getFiler().createResource(
                  StandardLocation.SOURCE_OUTPUT,
                  packageName, fileName + ".js");
              os = fo.openOutputStream();
              os.write(subClassCode
                  .getBytes(ModelGenerator.UTF8_CHARSET));
              os.close();
            }

          }
          else {
            FileObject fo = processingEnv.getFiler()
                .createResource(StandardLocation.SOURCE_OUTPUT,
                    packageName, fileName + ".js");
            OutputStream os = fo.openOutputStream();
            os.write(code.getBytes(ModelGenerator.UTF8_CHARSET));
            os.close();
          }

        }
View Full Code Here

        return classLoader;
    }

    @Override
    public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException {
        FileObject o = fileObjects.get(uri(location, packageName, relativeName));

        if (o != null) {
            return o;
        }
View Full Code Here

        {
            Map<String, Object> model = new HashMap<String, Object>();
            model.put("modules", modules);
            model.put("properties", gwtConfigProps);

            FileObject sourceFile = filer.createResource(StandardLocation.SOURCE_OUTPUT, MODULE_PACKAGENAME,
                    MODULE_FILENAME);
            OutputStream output = sourceFile.openOutputStream();
            new TemplateProcessor().process(MODULE_TEMPLATE, model, output);
            output.flush();
            output.close();
        }
        catch (IOException e)
View Full Code Here

        {
            Map<String, Object> model = new HashMap<String, Object>();
            model.put("modules", modules);
            model.put("properties", gwtConfigProps);

            FileObject sourceFile = filer.createResource(StandardLocation.SOURCE_OUTPUT, MODULE_PACKAGENAME,
                    MODULE_DEV_FILENAME);
            OutputStream output = sourceFile.openOutputStream();
            new TemplateProcessor().process(MODULE_DEV_TEMPLATE, model, output);
            output.flush();
            output.close();
        }
        catch (IOException e)
View Full Code Here

TOP

Related Classes of javax.tools.FileObject

Copyright © 2018 www.massapicom. 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.