Package org.apache.derby.iapi.services.classfile

Examples of org.apache.derby.iapi.services.classfile.ClassFormatOutput


    if (SanityManager.DEBUG) {
      if (SanityManager.DEBUG_ON("ClassLineNumbers")) {

      try {

        ClassFormatOutput sout = new ClassFormatOutput(2);

        int cpiUTF = classHold.addUtf8("GC.java");

        sout.putU2(cpiUTF);

        classHold.addAttribute("SourceFile", sout);
      } catch (IOException ioe) {
        SanityManager.THROWASSERT("i/o exception generating class file " + ioe.toString());
      }
View Full Code Here


    try {

      if (SanityManager.DEBUG) {
        if (SanityManager.DEBUG_ON("ClassLineNumbers")) {

          ClassFormatOutput sout = new ClassFormatOutput(2);

          int cpiUTF = classHold.addUtf8("GC.java");

          sout.putU2(cpiUTF);

          classHold.addAttribute("SourceFile", sout);
        }
      }
View Full Code Here

    // don't write an Exceptions attribute if there are no exceptions.
    if (numExc != 0) {

      try{
        ClassFormatOutput eout = new ClassFormatOutput((numExc * 2) + 2);

        eout.putU2(numExc); // number_of_exceptions

        for (int i = 0; i < numExc; i++) {
          // put each exception into the constant pool
          String e = thrownExceptions.elementAt(i).toString();
          int ei2 = modClass.addClassReference(e);

          // add constant pool index to exception attribute_info
          eout.putU2(ei2);
        }

        myEntry.addAttribute("Exceptions", eout);

      } catch (IOException ioe) {
View Full Code Here

  public int getRelativePC() {
    return cout.size() - codeOffset;
  }

  CodeChunk(boolean main) {
        cout = new ClassFormatOutput();
    if (main) {
      try {
        cout.putU2(0); // max_stack, placeholder for now
        cout.putU2(0); // max_locals, placeholder for now
        cout.putU4(0); // code_length, placeholder 4 now
View Full Code Here

   */
  void complete(ClassHolder ch, ClassMember method, int maxStack, int maxLocals) {

    int codeLength = getRelativePC();

    ClassFormatOutput out = cout;

    try {

      out.putU2(0); // exception_table_length

      if (SanityManager.DEBUG) {
        if (SanityManager.DEBUG_ON("ClassLineNumbers")) {
        // Add a single attribute - LineNumberTable
        // This add fake line numbers that are the pc offset in the method.
        out.putU2(1); // attributes_count

        int cpiUTF = ch.addUtf8("LineNumberTable");

        out.putU2(cpiUTF);
        out.putU4((codeLength * 4) + 2);
        out.putU2(codeLength);
        for (int i = 0; i < codeLength; i++) {
          out.putU2(i);
          out.putU2(i);
        }
        } else {
          out.putU2(0); // attributes_count
        }

      } else {
        out.putU2(0); // attributes_count
        // attributes is empty, a 0-element array.
      }
    } catch (IOException ioe) {
    }

View Full Code Here

     */
    final BCClass       cb;

  CodeChunk(BCClass cb) {
        this.cb = cb;
        cout = new ClassFormatOutput();
    try {
      cout.putU2(0); // max_stack, placeholder for now
      cout.putU2(0); // max_locals, placeholder for now
      cout.putU4(0); // code_length, placeholder 4 now
    } catch (IOException ioe) {
View Full Code Here

      aos.setLimit(byteCount);
    } catch (IOException e) {
            limitHit(e);
    }
   
    cout = new ClassFormatOutput(aos);
    pcDelta = pc;
  }
View Full Code Here

  void complete(BCMethod mb, ClassHolder ch,
      ClassMember method, int maxStack, int maxLocals) {

        int codeLength =  getPC();

    ClassFormatOutput out = cout;
   
    try {

      out.putU2(0); // exception_table_length

      if (SanityManager.DEBUG) {
        if (SanityManager.DEBUG_ON("ClassLineNumbers")) {
        // Add a single attribute - LineNumberTable
        // This add fake line numbers that are the pc offset in the method.
        out.putU2(1); // attributes_count

        int cpiUTF = ch.addUtf8("LineNumberTable");

        out.putU2(cpiUTF);
        out.putU4((codeLength * 4) + 2);
        out.putU2(codeLength);
        for (int i = 0; i < codeLength; i++) {
          out.putU2(i);
          out.putU2(i);
        }
        } else {
          out.putU2(0); // attributes_count
        }

      } else {
        out.putU2(0); // attributes_count
        // attributes is empty, a 0-element array.
      }
    } catch (IOException ioe) {
            limitHit(ioe);
    }
View Full Code Here

    try {

      if (SanityManager.DEBUG) {
        if (SanityManager.DEBUG_ON("ClassLineNumbers")) {

          ClassFormatOutput sout = new ClassFormatOutput(2);

          int cpiUTF = classHold.addUtf8("GC.java");

          sout.putU2(cpiUTF);

          classHold.addAttribute("SourceFile", sout);
        }
      }
View Full Code Here

    // don't write an Exceptions attribute if there are no exceptions.
    if (numExc != 0) {

      try{
        ClassFormatOutput eout = new ClassFormatOutput((numExc * 2) + 2);

        eout.putU2(numExc); // number_of_exceptions

        for (int i = 0; i < numExc; i++) {
          // put each exception into the constant pool
          String e = thrownExceptions.get(i).toString();
          int ei2 = modClass.addClassReference(e);

          // add constant pool index to exception attribute_info
          eout.putU2(ei2);
        }

        myEntry.addAttribute("Exceptions", eout);

      } catch (IOException ioe) {
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.services.classfile.ClassFormatOutput

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.