Home | History | Annotate | Download | only in code
      1 // Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file
      2 // for details. All rights reserved. Use of this source code is governed by a
      3 // BSD-style license that can be found in the LICENSE file.
      4 package com.android.tools.r8.code;
      5 
      6 public interface BytecodeStream {
      7 
      8   /**
      9    * Returns the current position from the starting index in shorts.
     10    *
     11    * @return offset from start in shorts.
     12    */
     13   int getOffset();
     14 
     15   /**
     16    * Returns the next short value from the stream of values.
     17    *
     18    * @return next short value in stream.
     19    */
     20   int nextShort();
     21 
     22   /**
     23    * Returns the next byte value from the stream, i.e., the high value of the next short followed by
     24    * the low value.
     25    *
     26    * Both bytes need to be consumed before the next call to {@link #nextShort()}.
     27    *
     28    * @return next byte value in the stream.
     29    */
     30   int nextByte();
     31 
     32   /**
     33    * Returns true of there are more values to be consumed.
     34    *
     35    * @return true if more values can be consumed.
     36    */
     37   boolean hasMore();
     38 }
     39