src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/BIPUSH.java
changeset 55496 8e0ae3830fca
parent 47216 71c04702a3d5
equal deleted inserted replaced
55495:badfa812b82a 55496:8e0ae3830fca
    27 /**
    27 /**
    28  * BIPUSH - Push byte on stack
    28  * BIPUSH - Push byte on stack
    29  *
    29  *
    30  * <PRE>Stack: ... -&gt; ..., value</PRE>
    30  * <PRE>Stack: ... -&gt; ..., value</PRE>
    31  *
    31  *
    32  * @version $Id: BIPUSH.java 1747278 2016-06-07 17:28:43Z britter $
    32  * @version $Id$
    33  */
    33  */
    34 public class BIPUSH extends Instruction implements ConstantPushInstruction {
    34 public class BIPUSH extends Instruction implements ConstantPushInstruction {
    35 
    35 
    36     private byte b;
    36     private byte b;
    37 
    37 
       
    38 
    38     /**
    39     /**
    39      * Empty constructor needed for the Class.newInstance() statement in
    40      * Empty constructor needed for Instruction.readInstruction.
    40      * Instruction.readInstruction(). Not to be used otherwise.
    41      * Not to be used otherwise.
    41      */
    42      */
    42     BIPUSH() {
    43     BIPUSH() {
    43     }
    44     }
    44 
    45 
    45     /**
    46 
    46      * Push byte on stack
    47     /** Push byte on stack
    47      */
    48      */
    48     public BIPUSH(final byte b) {
    49     public BIPUSH(final byte b) {
    49         super(com.sun.org.apache.bcel.internal.Const.BIPUSH, (short) 2);
    50         super(com.sun.org.apache.bcel.internal.Const.BIPUSH, (short) 2);
    50         this.b = b;
    51         this.b = b;
    51     }
    52     }
    52 
    53 
       
    54 
    53     /**
    55     /**
    54      * Dump instruction as byte code to stream out.
    56      * Dump instruction as byte code to stream out.
    55      */
    57      */
    56     @Override
    58     @Override
    57     public void dump(final DataOutputStream out) throws IOException {
    59     public void dump( final DataOutputStream out ) throws IOException {
    58         super.dump(out);
    60         super.dump(out);
    59         out.writeByte(b);
    61         out.writeByte(b);
    60     }
    62     }
       
    63 
    61 
    64 
    62     /**
    65     /**
    63      * @return mnemonic for instruction
    66      * @return mnemonic for instruction
    64      */
    67      */
    65     @Override
    68     @Override
    66     public String toString(final boolean verbose) {
    69     public String toString( final boolean verbose ) {
    67         return super.toString(verbose) + " " + b;
    70         return super.toString(verbose) + " " + b;
    68     }
    71     }
       
    72 
    69 
    73 
    70     /**
    74     /**
    71      * Read needed data (e.g. index) from file.
    75      * Read needed data (e.g. index) from file.
    72      */
    76      */
    73     @Override
    77     @Override
    74     protected void initFromFile(final ByteSequence bytes, final boolean wide) throws IOException {
    78     protected void initFromFile( final ByteSequence bytes, final boolean wide ) throws IOException {
    75         super.setLength(2);
    79         super.setLength(2);
    76         b = bytes.readByte();
    80         b = bytes.readByte();
    77     }
    81     }
       
    82 
    78 
    83 
    79     @Override
    84     @Override
    80     public Number getValue() {
    85     public Number getValue() {
    81         return Integer.valueOf(b);
    86         return Integer.valueOf(b);
    82     }
    87     }
    83 
    88 
    84     /**
    89 
    85      * @return Type.BYTE
    90     /** @return Type.BYTE
    86      */
    91      */
    87     @Override
    92     @Override
    88     public Type getType(final ConstantPoolGen cp) {
    93     public Type getType( final ConstantPoolGen cp ) {
    89         return Type.BYTE;
    94         return Type.BYTE;
    90     }
    95     }
    91 
    96 
       
    97 
    92     /**
    98     /**
    93      * Call corresponding visitor method(s). The order is: Call visitor methods
    99      * Call corresponding visitor method(s). The order is:
    94      * of implemented interfaces first, then call methods according to the class
   100      * Call visitor methods of implemented interfaces first, then
    95      * hierarchy in descending order, i.e., the most specific visitXXX() call
   101      * call methods according to the class hierarchy in descending order,
    96      * comes last.
   102      * i.e., the most specific visitXXX() call comes last.
    97      *
   103      *
    98      * @param v Visitor object
   104      * @param v Visitor object
    99      */
   105      */
   100     @Override
   106     @Override
   101     public void accept(final Visitor v) {
   107     public void accept( final Visitor v ) {
   102         v.visitPushInstruction(this);
   108         v.visitPushInstruction(this);
   103         v.visitStackProducer(this);
   109         v.visitStackProducer(this);
   104         v.visitTypedInstruction(this);
   110         v.visitTypedInstruction(this);
   105         v.visitConstantPushInstruction(this);
   111         v.visitConstantPushInstruction(this);
   106         v.visitBIPUSH(this);
   112         v.visitBIPUSH(this);