Examples of ByteParser


Examples of net.sf.rej.util.ByteParser

  }
 
  @Override
  public void setPayload(byte[] data) {
    super.setPayload(data); // TODO: ser / de-ser
    ByteParser parser = new ByteArrayByteParser(data);
    parser.setBigEndian(true);
    int numAnnotations = parser.getShortAsInt();
    for (int i=0; i < numAnnotations; i++) {
      this.annotations.add(new Annotation(parser, this.pool));
    }
  }
View Full Code Here

Examples of net.sf.rej.util.ByteParser

  }
 
  @Override
  public void setPayload(byte[] data) {
    super.setPayload(data); // TODO: ser / deser
    ByteParser parser = new ByteArrayByteParser(data);
    parser.setBigEndian(true);
    this.sourceNameIndex = parser.getShortAsInt();
  }
View Full Code Here

Examples of net.sf.rej.util.ByteParser

  }

  @Override
  public void setPayload(byte[] data) {
    super.setPayload(data);
        ByteParser parser = new ByteArrayByteParser(data);
        parser.setBigEndian(true);
        int count = parser.getShortAsInt();
        this.entries = new ArrayList<LocalVariableTypeEntry>(count);
        for (int i=0; i < count; i++) {
          int startPc = parser.getShortAsInt();
          int length = parser.getShortAsInt();
          int nameIndex = parser.getShortAsInt();
          int signatureIndex = parser.getShortAsInt();
          int index = parser.getShortAsInt();
          LocalVariableTypeEntry entry = new LocalVariableTypeEntry(this.pool, startPc, length, nameIndex, signatureIndex, index);
          entries.add(entry);
        }
  }
View Full Code Here

Examples of net.sf.rej.util.ByteParser

        return ser.getBytes();
    }
   
    @Override
    public void setPayload(byte[] data) {
        ByteParser parser = new ByteArrayByteParser(data);
        parser.setBigEndian(true);
        int length = parser.getShortAsInt();
        for (int i = 0; i < length; i++) {
            LocalVariable lv = new LocalVariable(parser, pool);
            this.localVariables.add(lv);
        }
    }
View Full Code Here

Examples of net.sf.rej.util.ByteParser

    super(nameIndex, pool);
  }

  @Override
  public void setPayload(byte[] data) {
        ByteParser parser = new ByteArrayByteParser(data);
        parser.setBigEndian(true);
        this.signatureIndex = parser.getShortAsInt();
  }
View Full Code Here

Examples of net.sf.rej.util.ByteParser

      return ByteToolkit.longToTwoBytes(this.constant, true);
    }
   
    @Override
    public void setPayload(byte[] data) {
        ByteParser parser = new ByteArrayByteParser(data);
        parser.setBigEndian(true);
        this.constant = parser.getShortAsInt();
    }
View Full Code Here

Examples of net.sf.rej.util.ByteParser

  @Override
  public int getSize(DecompilationContext dc) {
    if (this.instruction != null)
      return ((Widenable) this.instruction).getWideSize(dc);

    ByteParser parser = dc.getParser();
    parser.getByte(); // throw away 0xc4(wide)
    this.opcode = parser.peekByte();
    this.instruction = InstructionSet.getInstance().getInstruction(
        this.opcode);
    if (!(this.instruction instanceof Widenable))
      throw new RuntimeException("Instruction "
          + this.instruction.getMnemonic() + " is not Widenable.");
View Full Code Here

Examples of net.sf.rej.util.ByteParser

  }

  @Override
  public int getSize(DecompilationContext dc) {
    if (this.offsets == null) {
      ByteParser parser = dc.getParser();
      int startPos = parser.getPosition();
      parser.getByte(); // jump one byte forward -- this is the opcode
      // byte

      int pad = 0;
      while ((dc.getPosition() + pad + 1) % 4 != 0) {
        parser.getByte();
        pad++;
      }

      parser.getInt(); // def
      int npairs = (int) parser.getInt();
      for (int i = 0; i < npairs; i++) {
        parser.getInt(); // match
        parser.getInt(); // offset
      }

      return parser.getPosition() - startPos;
    } else {
      int size = 1; // opcode
      while ((dc.getPosition() + size) % 4 != 0) {
        size++;
      }
View Full Code Here

Examples of net.sf.rej.util.ByteParser

  }

  @Override
  public void setData(byte[] data, DecompilationContext dc) {
    ByteParser parser = new ByteArrayByteParser(data);
    parser.setBigEndian(true);
    parser.getByte(); // throw away OPCODE

    while ((dc.getPosition() + parser.getPosition()) % 4 != 0) {
      parser.getByte(); // throw away bytes until we are in a position
      // divisible by 4
    }

    this.def = new Label((int) parser.getInt() + dc.getPosition(),
        "lookup_label_def");

    int npairs = (int) parser.getInt();

    this.offsets = new HashMap<Integer, Label>();

    for (int i = 0; i < npairs; i++) {
      int match = (int) parser.getInt();
      int offset = (int) parser.getInt();
      Label label = new Label(dc.getPosition() + offset, "lookup_label_"
          + match);
      this.offsets.put(match, label);
    }
  }
View Full Code Here

Examples of org.apache.flink.types.parser.ByteParser

    };
  }

  @Override
  public FieldParser<Byte> getParser() {
    return new ByteParser();
  }
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.