Package net.sf.rej.util

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


    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

                + 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

        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

        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

    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

     * 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

        this.methodIndex = parser.getShortAsInt();
  }
 
  @Override
  public byte[] getPayload() {
        ByteSerializer ser = new ByteSerializer(true);
        ser.addShort(this.classIndex);
        ser.addShort(this.methodIndex);
       
        return ser.getBytes();
  }
View Full Code Here

  public String getName() {
    return this.pool.get(this.nameIndex).getValue();
  }

  public final byte[] getData() {
    ByteSerializer ser = new ByteSerializer(true);
    ser.addShort(this.nameIndex);
    byte[] payload = getPayload();
    ser.addInt(payload.length);
    ser.addBytes(payload);

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

      this.exceptions.addAll(exceptions);
    }

    @Override
  public byte[] getPayload() {
        ByteSerializer ser = new ByteSerializer(true);
        ser.addShort(this.exceptions.size());
      for (ExceptionDescriptor ex : this.exceptions) {
        ser.addShort(ex.getIndex());
      }

        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.