1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.dx.io.instructions;
18 
19 /**
20  * Cursor over code units, for reading or writing out Dalvik bytecode.
21  */
22 public interface CodeCursor {
23     /**
24      * Gets the cursor. The cursor is the offset in code units from
25      * the start of the input of the next code unit to be read or
26      * written, where the input generally consists of the code for a
27      * single method.
28      */
cursor()29     public int cursor();
30 
31     /**
32      * Gets the base address associated with the current cursor. This
33      * differs from the cursor value when explicitly set (by {@link
34      * #setBaseAddress). This is used, in particular, to convey base
35      * addresses to switch data payload instructions, whose relative
36      * addresses are relative to the address of a dependant switch
37      * instruction.
38      */
baseAddressForCursor()39     public int baseAddressForCursor();
40 
41     /**
42      * Sets the base address for the given target address to be as indicated.
43      *
44      * @see #baseAddressForCursor
45      */
setBaseAddress(int targetAddress, int baseAddress)46     public void setBaseAddress(int targetAddress, int baseAddress);
47 }
48