Examples of ByteSerializer


Examples of net.sf.rej.util.ByteSerializer

    this.label = new Label(addr);
  }

  @Override
  public byte[] getData(DecompilationContext dc) {
    ByteSerializer ser = new ByteSerializer(true);
    ser.addByte(OPCODE);
    ser.addShort(this.label.getPosition() - dc.getPosition());
    return ser.getBytes();
  }
View Full Code Here

Examples of net.sf.rej.util.ByteSerializer

      this.nameIndex = index;
    }
   
    @Override
  public byte[] getData() {
        ByteSerializer ser = new ByteSerializer(true);
        ser.addByte(getType());
        ser.addShort(this.nameIndex);

        return ser.getBytes();
    }
View Full Code Here

Examples of net.sf.rej.util.ByteSerializer

        return "(long) " + String.valueOf(this.value);
    }

    @Override
  public byte[] getData() {
        ByteSerializer ser = new ByteSerializer(true);
        ser.addByte(getType());
        ser.addInt(this.value >> 32);
        ser.addInt(this.value & 0xFFFFFFFFL);

        return ser.getBytes();
    }
View Full Code Here

Examples of net.sf.rej.util.ByteSerializer

    return "(double) " + String.valueOf(getDoubleValue());
  }

  @Override
  public byte[] getData() {
    ByteSerializer ser = new ByteSerializer(true);
    ser.addByte(getType());
    ser.addInt(this.highBytes);
    ser.addInt(this.lowBytes);

    return ser.getBytes();
  }
View Full Code Here

Examples of net.sf.rej.util.ByteSerializer

    return this.pool.get(this.descriptorIndex).getValue();
  }

  @Override
  public byte[] getData() {
    ByteSerializer ser = new ByteSerializer(true);
    ser.addByte(getType());
    ser.addShort(this.nameIndex);
    ser.addShort(this.descriptorIndex);

    return ser.getBytes();
  }
View Full Code Here

Examples of net.sf.rej.util.ByteSerializer

                + this.pool.get(this.stringIndex) + ")";
    }

    @Override
  public byte[] getData() {
        ByteSerializer ser = new ByteSerializer(true);
        ser.addByte(getType());
        ser.addShort(this.stringIndex);

        return ser.getBytes();
    }
View Full Code Here

Examples of net.sf.rej.util.ByteSerializer

        return "(float) " + String.valueOf(this.getFloatValue());
    }

    @Override
  public byte[] getData() {
        ByteSerializer ser = new ByteSerializer(true);
        ser.addByte(getType());
        ser.addInt(this.bytes);

        return ser.getBytes();
    }
View Full Code Here

Examples of net.sf.rej.util.ByteSerializer

        this.attributes = new Attributes();
    }

    @Override
  public byte[] getPayload() {
        ByteSerializer ser = new ByteSerializer(true);
        ser.addShort(this.maxStack);
        ser.addShort(this.maxLocals);
        byte[] data = this.code.getData();
        ser.addInt(data.length);
        ser.addBytes(data);
        ser.addBytes(this.exceptions.getData());
        ser.addBytes(this.attributes.getData());

        return ser.getBytes();
    }
View Full Code Here

Examples of net.sf.rej.util.ByteSerializer

    this.startLabel = new Label(startPc, getName() + "_start");
    this.endLabel = new Label(startPc + length, getName() + "_end");
  }

  public byte[] getData() {
    ByteSerializer ser = new ByteSerializer(true);
    ser.addShort(getStartPc());
    ser.addShort(getEndPc() - getStartPc());
    ser.addShort(this.nameIndex);
    ser.addShort(this.descriptorIndex);
    ser.addShort(this.index);
    return ser.getBytes();
  }
View Full Code Here

Examples of net.sf.rej.util.ByteSerializer

     * Serializes this class. The produced byte array is in the class file format.
     * It may be written to a .class file and it may be loaded by a <code>ClassLoader</code>.
     * @return the class data.
     */
    public byte[] getData() {
        ByteSerializer ser = new ByteSerializer(true);
        // 0:
        ser.addBytes(ClassFile.magic);

        // 4:
        ser.addShort(getMinorVersion());
        ser.addShort(getMajorVersion());
       
        // 8:
        ser.addBytes(this.pool.getData());

        // 8+pooldata:
        ser.addShort(this.accessFlags);
        ser.addShort(this.thisClass);
        ser.addShort(this.superClass);

        // 14+pooldata:
        ser.addShort(this.interfaces.size());
        // 16+pooldata:
        for (Interface anInterface : this.interfaces) {
            ser.addShort(anInterface.getNameIndex());
        }

        // 16+pooldata+interfaces*2
        ser.addShort(this.fields.size());
        // 18+pooldata+interfaces*2
        for (Field field : this.fields) {
            ser.addBytes(field.getData());
        }

        // 18+pooldata+interfaces*2+fielddata
        ser.addShort(this.methods.size());
        // 20+pooldata+interfaces*2+fielddata
        for (Method method : this.methods) {
            ser.addBytes(method.getData());
        }

        // 20+pooldata+interfaces*2+fielddata+methoddata
        ser.addBytes(this.attributes.getData());
        return ser.getBytes();
    }
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.