Package javax.tools

Examples of javax.tools.JavaFileObject.openInputStream()


        JavaFileObject file = jfm.getJavaFileForInput(StandardLocation.CLASS_OUTPUT,
                                                      name, Kind.CLASS);
        if (file == null) {
          throw new FileNotFoundException();
        }
        byte[] bytes = ByteStreams.toByteArray(file.openInputStream());
        return defineClass(name, bytes, 0, bytes.length);
      } catch (IOException e) {
        throw new ClassNotFoundException();
      }
    }
View Full Code Here


            );
            if (classFile == null) throw new ClassNotFoundException(className);

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            {
                InputStream is = classFile.openInputStream();
                try {
                    byte[] buffer = new byte[8192];
                    for (;;) {
                        int count = is.read(buffer);
                        if (count == -1) break;
View Full Code Here

    JarOutputStream jarOutputStream = new JarOutputStream(outStream);
    JarEntry jarEntry = new JarEntry(classFile.getName());
    jarEntry.setTime(classFile.lastModified());
    jarOutputStream.putNextEntry(jarEntry);

    InputStream in = javaFileObject.openInputStream();
    byte buffer[] = new byte[4096];
    while (true) {
      int nRead = in.read(buffer, 0, buffer.length);
      if (nRead <= 0)
        break;
View Full Code Here

                documentation = "";
            } else {
                // read from file
                try {
                    documentation = readHTMLDocumentation(
                        overviewPath.openInputStream(),
                        overviewPath);
                } catch (IOException exc) {
                    documentation = "";
                    env.error(null, "javadoc.File_Read_Error", overviewPath.getName());
                }
View Full Code Here

        }

        /** Open an input stream for the file. */
        public InputStream openInputStream() throws IOException {
            JavaFileObject fo = getJavaFileObjectForInput(file);
            return new BufferedInputStream(fo.openInputStream());
        }

        /**
         * Open an output stream for the file.
         * The file must have been created with a location of
View Full Code Here

        }

        /** Open an input stream for the file. */
        public InputStream openInputStream() throws IOException {
            JavaFileObject fo = getJavaFileObjectForInput(file);
            return new BufferedInputStream(fo.openInputStream());
        }

        /**
         * Open an output stream for the file.
         * The file must have been created with a location of
View Full Code Here

    JarOutputStream jarOutputStream = new JarOutputStream(outStream);
    JarEntry jarEntry = new JarEntry(classFile.getName());
    jarEntry.setTime(classFile.lastModified());
    jarOutputStream.putNextEntry(jarEntry);

    InputStream in = javaFileObject.openInputStream();
    byte buffer[] = new byte[4096];
    while (true) {
      int nRead = in.read(buffer, 0, buffer.length);
      if (nRead <= 0)
        break;
View Full Code Here

                documentation = "";
            } else {
                // read from file
                try {
                    documentation = readHTMLDocumentation(
                        overviewPath.openInputStream(),
                        overviewPath);
                } catch (IOException exc) {
                    documentation = "";
                    env.error(null, "javadoc.File_Read_Error", overviewPath.getName());
                }
View Full Code Here

    JarOutputStream jarOutputStream = new JarOutputStream(outStream);
    JarEntry jarEntry = new JarEntry(classFile.getName());
    jarEntry.setTime(classFile.lastModified());
    jarOutputStream.putNextEntry(jarEntry);

    InputStream in = javaFileObject.openInputStream();
    byte buffer[] = new byte[4096];
    while (true) {
      int nRead = in.read(buffer, 0, buffer.length);
      if (nRead <= 0)
        break;
View Full Code Here

  public InputStream findGeneratedSource(String classname) throws IOException {
    JavaFileObject fileObject = fileManager.getJavaFileForInput(StandardLocation.CLASS_OUTPUT, classname, Kind.SOURCE);
    if (fileObject == null) {
      return null;
    }
    return fileObject.openInputStream();
  }

  /**
   * Compiles this project's sources. All generated files will be placed into the output directory.
   *
 
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.