Package net.sf.rej.util

Examples of net.sf.rej.util.ByteSerializer


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

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

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


    this.value = newValue;
  }

  @Override
  public byte[] getData() {
    ByteSerializer ser = new ByteSerializer(true);
    ser.addByte(getType());
    try {
      byte[] data = this.value.getBytes("UTF-8");
      ser.addShort(data.length);
      ser.addBytes(data);
    } catch (Exception e) {
      e.printStackTrace();
    }

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

   * Serializes this constant pool into a byte array. The serialization format
   * is according to the java class file format.
   * @return this constant pool as a byte array.
   */
  public byte[] getData() {
        ByteSerializer ser = new ByteSerializer(true);
        ser.addShort(size());

        for (int i = 1; i < size(); i++) {
            ConstantPoolInfo cpi = get(i);
            ser.addBytes(cpi.getData());
           
            // 2 word(8 byte) types take up 2 indices
            if (cpi.getType() == ConstantPoolInfo.LONG
               || cpi.getType() == ConstantPoolInfo.DOUBLE) {
              i++;
            }
        }
       
        return ser.getBytes();
  }
View Full Code Here

    this.increment = (int) ByteToolkit.getLong(data, 2, 1, true);
  }

  @Override
  public byte[] getData(DecompilationContext dc) {
    ByteSerializer ser = new ByteSerializer(true);
    ser.addByte(OPCODE);
    ser.addByte(this.index);
    ser.addByte(this.increment);

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

  public int getWideSize(DecompilationContext dc) {
    return WIDE_SIZE;
  }

  public byte[] getWideData(DecompilationContext dc) {
    ByteSerializer ser = new ByteSerializer(true);
    ser.addByte(_wide.OPCODE);
    ser.addByte(OPCODE);
    ser.addShort(this.index);
    ser.addShort(this.increment);

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

    this.index = (int) ByteToolkit.getLong(data, 1, 2, true);
  }

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

    this.index = (int) ByteToolkit.getLong(data, 1, 1, true);
  }

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

  public int getWideSize(DecompilationContext dc) {
    return WIDE_SIZE;
  }

  public byte[] getWideData(DecompilationContext dc) {
    ByteSerializer ser = new ByteSerializer(true);
    ser.addByte(_wide.OPCODE);
    ser.addByte(OPCODE);
    ser.addShort(this.index);
    return ser.getBytes();
  }
View Full Code Here

    this.index = (int) ByteToolkit.getLong(data, 1, 1, true);
  }

  @Override
  public byte[] getData(DecompilationContext dc) {
    ByteSerializer ser = new ByteSerializer(true);
    ser.addByte(OPCODE);
    ser.addByte(this.index);

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

  public void setWideData(byte[] data, DecompilationContext dc) {
    this.index = (int) ByteToolkit.getLong(data, 2, 2, true);
  }

  public byte[] getWideData(DecompilationContext dc) {
    ByteSerializer ser = new ByteSerializer(true);
    ser.addByte(_wide.OPCODE);
    ser.addByte(OPCODE);
    ser.addShort(this.index);

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

TOP

Related Classes of net.sf.rej.util.ByteSerializer

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.