Examples of SegmentConstantPool


Examples of org.apache.harmony.archive.internal.pack200.Segment.SegmentConstantPool

  public Object getValue(long value, Segment segment) throws Pack200Exception {
    if (layout.startsWith("R")) {
      // references
      if (layout.indexOf('N') != -1)
        value--;
      SegmentConstantPool pool = segment.getConstantPool();
      if (layout.startsWith("RU")) {
        return pool.getValue(SegmentConstantPool.UTF_8, value);
      } else if (layout.startsWith("RS")) {
        return pool.getValue(SegmentConstantPool.SIGNATURE, value);
      }
    }
    throw new Pack200Exception("Unknown layout encoding: " + layout);
  }
View Full Code Here

Examples of org.apache.harmony.pack200.Segment.SegmentConstantPool

    return getValue(layout, value, segment);
  }

  private static Object getValue(String layout, long value, Segment segment)
      throws Pack200Exception {
    SegmentConstantPool pool = segment.getConstantPool();
    if (layout.startsWith("R")) {
      // references
      if (layout.indexOf('N') != -1)
        value--;
      if (layout.startsWith("RU")) {
        return pool.getValue(SegmentConstantPool.UTF_8, value);
      } else if (layout.startsWith("RS")) {
        return pool.getValue(SegmentConstantPool.SIGNATURE, value);
      }
    } else if (layout.startsWith("K")) {
      char type = layout.charAt(1);
      switch (type) {
      case 'S': // String
        return pool.getValue(SegmentConstantPool.CP_STRING, value);
      case 'I': // Int (or byte or short)
      case 'C': // Char
        return pool.getValue(SegmentConstantPool.CP_INT, value);
      case 'F': // Float
        return pool.getValue(SegmentConstantPool.CP_FLOAT, value);
      case 'J': // Long
        return pool.getValue(SegmentConstantPool.CP_LONG,value);
      case 'D': // Double
        return pool.getValue(SegmentConstantPool.CP_DOUBLE,value);
      }
    }
    throw new Pack200Exception("Unknown layout encoding: " + layout);
  }
View Full Code Here

Examples of org.apache.harmony.pack200.SegmentConstantPool

      final Object[][] data = new Object[][] {
          { }, // ALL
          { "Zero", "One" }, // UTF-8
          { "Ein", "Zwei" }, // Signature
      };
      return new SegmentConstantPool(null) {
        public Object getValue(int cp, long index) {
          if (index == -1)
            return null;
          return data[cp][(int)index];
        }
View Full Code Here

Examples of org.apache.harmony.pack200.SegmentConstantPool

            OperandManager operandManager) {
        ClassFileEntry[] nested = null;
        int offset = getOffset(operandManager);
        if(offset == 0) {
            // Use current class
            SegmentConstantPool globalPool = operandManager.globalConstantPool();
            nested = new ClassFileEntry[] {
                        globalPool.getClassPoolEntry(operandManager.getCurrentClass())
            };
            byteCode.setNested(nested);
            byteCode.setNestedPositions(new int[][] {{0,2}});
        } else {
            // Look up the class in the classpool
View Full Code Here

Examples of org.apache.harmony.pack200.SegmentConstantPool

    protected abstract int getOffset(OperandManager operandManager);
    protected abstract int getPoolID();
    protected abstract String context(OperandManager operandManager);
   
    protected void setNestedEntries(ByteCode byteCode, OperandManager operandManager, int offset) throws Pack200Exception {
        SegmentConstantPool globalPool = operandManager.globalConstantPool();
        ClassFileEntry[] nested = null;
        nested = new ClassFileEntry[] {
                globalPool.getClassSpecificPoolEntry(getPoolID(), offset, context(operandManager))
                };
        byteCode.setNested(nested);
        byteCode.setNestedPositions(new int[][] {{0, 2}});
    }
View Full Code Here

Examples of org.apache.harmony.pack200.SegmentConstantPool

    protected int getPoolID() {
        return SegmentConstantPool.CP_STRING;
    }
   
    protected void setNestedEntries(ByteCode byteCode, OperandManager operandManager, int offset) throws Pack200Exception {
        SegmentConstantPool globalPool = operandManager.globalConstantPool();
        ClassFileEntry[] nested = null;
        nested = new ClassFileEntry[] {
                new CPString((String)globalPool.getValue(getPoolID(), offset))
                };
        byteCode.setNested(nested);
        if(widened) {
            byteCode.setNestedPositions(new int[][]{{0, 2}});
        } else {
View Full Code Here

Examples of org.apache.harmony.pack200.SegmentConstantPool

    protected abstract int getPoolID();
    protected abstract int getOffset(OperandManager operandManager);
   
    protected void setNestedEntries(ByteCode byteCode, OperandManager operandManager, int offset) throws Pack200Exception {
        SegmentConstantPool globalPool = operandManager.globalConstantPool();
        ClassFileEntry[] nested = null;
        nested = new ClassFileEntry[] {
                    globalPool.getConstantPoolEntry(getPoolID(), offset)
            };
        byteCode.setNested(nested);
        byteCode.setNestedPositions(new int[][] {{0,2}});
    }
View Full Code Here

Examples of org.apache.harmony.pack200.SegmentConstantPool

    protected int getOffset(OperandManager operandManager) {
        return operandManager.nextInitRef();
    }

    protected void setNestedEntries(ByteCode byteCode, OperandManager operandManager, int offset) throws Pack200Exception {
        SegmentConstantPool globalPool = operandManager.globalConstantPool();
        ClassFileEntry[] nested = null;
        nested = new ClassFileEntry[] {
                globalPool.getInitMethodPoolEntry(SegmentConstantPool.CP_METHOD, offset, context(operandManager))
        };
        byteCode.setNested(nested);
        byteCode.setNestedPositions(new int[][] {{0, 2}});
    }
View Full Code Here

Examples of org.apache.harmony.pack200.SegmentConstantPool

    protected int getPoolID() {
        return SegmentConstantPool.CP_STRING;
    }

    protected void setNestedEntries(ByteCode byteCode, OperandManager operandManager, int offset) throws Pack200Exception {
        SegmentConstantPool globalPool = operandManager.globalConstantPool();
        ClassFileEntry[] nested = null;
        nested = new ClassFileEntry[] {
                new CPString((String)globalPool.getValue(getPoolID(), offset))
                };
        byteCode.setNested(nested);
        if(widened) {
            byteCode.setNestedPositions(new int[][]{{0, 2}});
        } else {
View Full Code Here

Examples of org.apache.harmony.pack200.SegmentConstantPool

    protected abstract int getPoolID();
    protected abstract int getOffset(OperandManager operandManager);

    protected void setNestedEntries(ByteCode byteCode, OperandManager operandManager, int offset) throws Pack200Exception {
        SegmentConstantPool globalPool = operandManager.globalConstantPool();
        ClassFileEntry[] nested = null;
        nested = new ClassFileEntry[] {
                    globalPool.getConstantPoolEntry(getPoolID(), offset)
            };
        byteCode.setNested(nested);
        byteCode.setNestedPositions(new int[][] {{0,2}});
    }
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.