Package org.eclipse.jdt.internal.compiler.classfmt

Examples of org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader


                try {

                    if (name.startsWith("play.") || name.startsWith("java.") || name.startsWith("javax.")) {
                        byte[] bytes = Play.classloader.getClassDefinition(name);
                        if (bytes != null) {
                            ClassFileReader classFileReader = new ClassFileReader(bytes, name.toCharArray(), true);
                            return new NameEnvironmentAnswer(classFileReader, null);
                        }
                        return null;
                    }

                    char[] fileName = name.toCharArray();
                    ApplicationClass applicationClass = applicationClasses.getApplicationClass(name);

                    // ApplicationClass exists
                    if (applicationClass != null) {

                        if (applicationClass.javaByteCode != null) {
                            ClassFileReader classFileReader = new ClassFileReader(applicationClass.javaByteCode, fileName, true);
                            return new NameEnvironmentAnswer(classFileReader, null);
                        }
                        // Cascade compilation
                        ICompilationUnit compilationUnit = new CompilationUnit(name);
                        return new NameEnvironmentAnswer(compilationUnit, null);
                    }

                    // So it's a standard class
                    byte[] bytes = Play.classloader.getClassDefinition(name);
                    if (bytes != null) {
                        ClassFileReader classFileReader = new ClassFileReader(bytes, fileName, true);
                        return new NameEnvironmentAnswer(classFileReader, null);
                    }

                    // So it does not exist
                    return null;
View Full Code Here


      if (!name.startsWith("japidviews.")) {
        // let super class loader to load the bytecode
        byte[] bytes = crlr.getClassDefinition(name);
        if (bytes != null) {
          // System.out.println("japid: byecode found: " + name);
          return new NameEnvironmentAnswer(new ClassFileReader(bytes, fileName, true), null);
        } else {
          // System.out.println("japid: bytes not found: " + name);
        }
      } else { // japidviews
        RendererClass applicationClass = JapidRenderer.japidClasses.get(name); // I don't like this XXX

        // ApplicationClass exists
        if (applicationClass != null) {

          byte[] bytecode = applicationClass.getBytecode();
          if (bytecode != null) {
            return new NameEnvironmentAnswer(new ClassFileReader(bytecode, fileName, true), null);
          } else
            // Cascade compilation
            return new NameEnvironmentAnswer(new CompilationUnit(name), null);
        }
      }
View Full Code Here

                                baos.write(buf, 0, count);
                            }
                            baos.flush();
                            classBytes = baos.toByteArray();
                            char[] fileName = className.toCharArray();
                            ClassFileReader classFileReader =
                                new ClassFileReader(classBytes, fileName,
                                                    true);
                            return
                                new NameEnvironmentAnswer(classFileReader, null);
                        }
                    } catch (IOException exc) {
View Full Code Here

                }
            }

            private NameEnvironmentAnswer createNameEnvironmentAnswer(final String pClazzName, final byte[] clazzBytes) throws ClassFormatException {
                final char[] fileName = pClazzName.toCharArray();
                final ClassFileReader classFileReader = new ClassFileReader(clazzBytes, fileName, true);
                return new NameEnvironmentAnswer(classFileReader, null);
            }

            private boolean isSourceAvailable(final String pClazzName, final ResourceReader pReader) {
                // FIXME: this should not be tied to the extension
View Full Code Here

                }
            }

            private NameEnvironmentAnswer createNameEnvironmentAnswer(final String pClazzName, final byte[] clazzBytes) throws ClassFormatException {
                final char[] fileName = pClazzName.toCharArray();
                final ClassFileReader classFileReader = new ClassFileReader(clazzBytes, fileName, true);
                return new NameEnvironmentAnswer(classFileReader, null);
            }

            private boolean isSourceAvailable(final String pClazzName, final ResourceReader pReader) {
                // FIXME: this should not be tied to the extension
View Full Code Here

              buffer.length);
          while ((bytes = is.read(buffer, 0, buffer.length)) > 0)
            os.write(buffer, 0, bytes);

          os.flush();
          ClassFileReader classFileReader = new ClassFileReader(
              os.toByteArray(), fullName.toCharArray(), true);
          return new NameEnvironmentAnswer(classFileReader, null);
        }
        return null;
      } catch (IOException e) {
View Full Code Here

        //
        byte[] classBytes = byteCode.getBytes();
        char[] loc = byteCode.getLocation().toCharArray();
        try {
          logger.log(TreeLogger.SPAM, "Found cached bytes", null);
          ClassFileReader cfr = new ClassFileReader(classBytes, loc);
          NameEnvironmentAnswer out = new NameEnvironmentAnswer(cfr, null);
          nameEnvironmentAnswerForTypeName.put(qname, out);
          return out;
        } catch (ClassFormatException e) {
          // Bad bytecode in the cache. Remove it from the cache.
View Full Code Here

                                baos.write(buf, 0, count);
                            }
                            baos.flush();
                            classBytes = baos.toByteArray();
                            char[] fileName = className.toCharArray();
                            ClassFileReader classFileReader =
                                new ClassFileReader(classBytes, fileName,
                                                    true);
                            return
                                new NameEnvironmentAnswer(classFileReader, null);
                        }
                    } catch (IOException exc) {
View Full Code Here

               
                final byte[] clazzBytes = pStore.read( resourceName );
                if (clazzBytes != null) {
                    final char[] fileName = pClazzName.toCharArray();
                    try {
                        final ClassFileReader classFileReader = new ClassFileReader(clazzBytes, fileName, true);
                        return new NameEnvironmentAnswer(classFileReader, null);
                    } catch (final ClassFormatException e) {
                        throw new RuntimeException( "ClassFormatException in loading class '" + fileName + "' with JCI." );
                    }
                }
               
               
                final InputStream is = pClassLoader.getResourceAsStream(resourceName);
                if (is == null) {
                    return null;
                }

                final byte[] buffer = new byte[8192];
                final ByteArrayOutputStream baos = new ByteArrayOutputStream(buffer.length);
                int count;
                try {
                    while ((count = is.read(buffer, 0, buffer.length)) > 0) {
                        baos.write(buffer, 0, count);
                    }
                    baos.flush();
                    final char[] fileName = pClazzName.toCharArray();
                    final ClassFileReader classFileReader = new ClassFileReader(baos.toByteArray(), fileName, true);
                    return new NameEnvironmentAnswer(classFileReader, null);
                } catch ( final IOException e ) {
                    throw new RuntimeException( "could not read class",
                                                e );
                } catch ( final ClassFormatException e ) {
View Full Code Here

                byte[] classBytes = IOUtil.toByteArray( is );

                char[] fileName = className.toCharArray();

                ClassFileReader classFileReader = new ClassFileReader( classBytes, fileName, true );

                return new NameEnvironmentAnswer( classFileReader, null );
            }
            catch ( IOException e )
            {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader

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.