本文整理汇总了Java中org.apache.bcel.util.ByteSequence类的典型用法代码示例。如果您正苦于以下问题:Java ByteSequence类的具体用法?Java ByteSequence怎么用?Java ByteSequence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ByteSequence类属于org.apache.bcel.util包,在下文中一共展示了ByteSequence类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initFromFile
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Read needed data (e.g. index) from file.
*/
protected void initFromFile(ByteSequence bytes, boolean wide)
throws IOException {
super.initFromFile(bytes, wide);
int low = bytes.readInt();
int high = bytes.readInt();
match_length = high - low + 1;
fixed_length = (short) (13 + match_length * 4);
length = (short) (fixed_length + padding);
match = new int[match_length];
indices = new int[match_length];
targets = new InstructionHandle[match_length];
for (int i = low; i <= high; i++)
match[i - low] = i;
for (int i = 0; i < match_length; i++) {
indices[i] = bytes.readInt();
}
}
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:26,代码来源:TABLESWITCH.java
示例2: initFromFile
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Read needed data (e.g. index) from file.
*/
protected void initFromFile(ByteSequence bytes, boolean wide)
throws IOException {
super.initFromFile(bytes, wide); // reads padding
match_length = bytes.readInt();
fixed_length = (short) (9 + match_length * 8);
length = (short) (fixed_length + padding);
match = new int[match_length];
indices = new int[match_length];
targets = new InstructionHandle[match_length];
for (int i = 0; i < match_length; i++) {
match[i] = bytes.readInt();
indices[i] = bytes.readInt();
}
}
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:21,代码来源:LOOKUPSWITCH.java
示例3: initFromFile
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Read needed data (e.g. index) from file.
* PRE: (ILOAD <= tag <= ALOAD_3) || (ISTORE <= tag <= ASTORE_3)
*/
protected void initFromFile(ByteSequence bytes, boolean wide)
throws IOException
{
if(wide) {
n = bytes.readUnsignedShort();
length = 4;
} else if(((opcode >= Constants.ILOAD) &&
(opcode <= Constants.ALOAD)) ||
((opcode >= Constants.ISTORE) &&
(opcode <= Constants.ASTORE))) {
n = bytes.readUnsignedByte();
length = 2;
} else if(opcode <= Constants.ALOAD_3) { // compact load instruction such as ILOAD_2
n = (opcode - Constants.ILOAD_0) % 4;
length = 1;
} else { // Assert ISTORE_0 <= tag <= ASTORE_3
n = (opcode - Constants.ISTORE_0) % 4;
length = 1;
}
}
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:25,代码来源:LocalVariableInstruction.java
示例4: codeToString
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Disassemble a byte array of JVM byte codes starting from code line
* `index' and return the disassembled string representation. Decode only
* `num' opcodes (including their operands), use -1 if you want to
* decompile everything.
*
* @param code byte code array
* @param constant_pool Array of constants
* @param index offset in `code' array
* <EM>(number of opcodes, not bytes!)</EM>
* @param length number of opcodes to decompile, -1 for all
* @param verbose be verbose, e.g. print constant pool index
* @return String representation of byte codes
*/
public static final String codeToString(byte[] code,
ConstantPool constant_pool,
int index, int length, boolean verbose)
{
StringBuffer buf = new StringBuffer(code.length * 20); // Should be sufficient
ByteSequence stream = new ByteSequence(code);
try {
for(int i=0; i < index; i++) // Skip `index' lines of code
codeToString(stream, constant_pool, verbose);
for(int i=0; stream.available() > 0; i++) {
if((length < 0) || (i < length)) {
String indices = fillup(stream.getIndex() + ":", 6, true, ' ');
buf.append(indices + codeToString(stream, constant_pool, verbose) + '\n');
}
}
} catch(IOException e) {
System.out.println(buf.toString());
e.printStackTrace();
throw new ClassFormatException("Byte code error: " + e);
}
return buf.toString();
}
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:40,代码来源:Utility.java
示例5: initFromFile
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Read needed data (e.g. index) from file.
*/
protected void initFromFile( ByteSequence bytes, boolean wide ) throws IOException {
super.initFromFile(bytes, wide);
int low = bytes.readInt();
int high = bytes.readInt();
match_length = high - low + 1;
fixed_length = (short) (13 + match_length * 4);
length = (short) (fixed_length + padding);
match = new int[match_length];
indices = new int[match_length];
targets = new InstructionHandle[match_length];
for (int i = low; i <= high; i++) {
match[i - low] = i;
}
for (int i = 0; i < match_length; i++) {
indices[i] = bytes.readInt();
}
}
开发者ID:Hu6,项目名称:VestaClient,代码行数:21,代码来源:TABLESWITCH.java
示例6: initFromFile
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Read needed data (e.g. index) from file.
* PRE: (ILOAD <= tag <= ALOAD_3) || (ISTORE <= tag <= ASTORE_3)
*/
protected void initFromFile( ByteSequence bytes, boolean wide ) throws IOException {
if (wide) {
n = bytes.readUnsignedShort();
length = 4;
} else if (((opcode >= Constants.ILOAD) && (opcode <= Constants.ALOAD))
|| ((opcode >= Constants.ISTORE) && (opcode <= Constants.ASTORE))) {
n = bytes.readUnsignedByte();
length = 2;
} else if (opcode <= Constants.ALOAD_3) { // compact load instruction such as ILOAD_2
n = (opcode - Constants.ILOAD_0) % 4;
length = 1;
} else { // Assert ISTORE_0 <= tag <= ASTORE_3
n = (opcode - Constants.ISTORE_0) % 4;
length = 1;
}
}
开发者ID:Hu6,项目名称:VestaClient,代码行数:21,代码来源:LocalVariableInstruction.java
示例7: codeToString
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Disassemble a byte array of JVM byte codes starting from code line
* `index' and return the disassembled string representation. Decode only
* `num' opcodes (including their operands), use -1 if you want to
* decompile everything.
*
* @param code byte code array
* @param constant_pool Array of constants
* @param index offset in `code' array
* <EM>(number of opcodes, not bytes!)</EM>
* @param length number of opcodes to decompile, -1 for all
* @param verbose be verbose, e.g. print constant pool index
* @return String representation of byte codes
*/
public static final String codeToString( byte[] code, ConstantPool constant_pool, int index,
int length, boolean verbose ) {
StringBuffer buf = new StringBuffer(code.length * 20); // Should be sufficient
ByteSequence stream = new ByteSequence(code);
try {
for (int i = 0; i < index; i++) {
codeToString(stream, constant_pool, verbose);
}
for (int i = 0; stream.available() > 0; i++) {
if ((length < 0) || (i < length)) {
String indices = fillup(stream.getIndex() + ":", 6, true, ' ');
buf.append(indices).append(codeToString(stream, constant_pool, verbose))
.append('\n');
}
}
} catch (IOException e) {
System.out.println(buf.toString());
e.printStackTrace();
throw new ClassFormatException("Byte code error: " + e);
}
return buf.toString();
}
开发者ID:Hu6,项目名称:VestaClient,代码行数:37,代码来源:Utility.java
示例8: initFromFile
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Read needed data (e.g. index) from file.
*/
protected void initFromFile(ByteSequence bytes, boolean wide)
throws IOException {
super.initFromFile(bytes, wide);
int low = bytes.readInt();
int high = bytes.readInt();
match_length = high - low + 1;
fixed_length = (short) (13 + match_length * 4);
length = (short) (fixed_length + padding);
match = new int[match_length];
indices = new int[match_length];
targets = new InstructionHandle[match_length];
for (int i = low; i <= high; i++)
match[i - low] = i;
for (int i = 0; i < match_length; i++) {
indices[i] = bytes.readInt();
}
}
开发者ID:miuirussia,项目名称:KJBE,代码行数:26,代码来源:TABLESWITCH.java
示例9: getInstructions
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* @return an array of instructions without target information for branch instructions.
*/
public Instruction[] getInstructions() {
ByteSequence bytes = new ByteSequence(getByteCode());
ArrayList<Instruction> instructions = new ArrayList<Instruction>();
try {
while (bytes.available() > 0) {
instructions.add(Instruction.readInstruction(bytes));
}
} catch (IOException e) {
throw new ClassGenException(e.toString());
}
Instruction[] result = new Instruction[instructions.size()];
instructions.toArray(result);
return result;
}
开发者ID:miuirussia,项目名称:KJBE,代码行数:20,代码来源:InstructionList.java
示例10: initFromFile
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Read needed data (e.g. index) from file.
*/
protected void initFromFile(ByteSequence bytes, boolean wide)
throws IOException {
super.initFromFile(bytes, wide); // reads padding
match_length = bytes.readInt();
fixed_length = (short) (9 + match_length * 8);
length = (short) (fixed_length + padding);
match = new int[match_length];
indices = new int[match_length];
targets = new InstructionHandle[match_length];
for (int i = 0; i < match_length; i++) {
match[i] = bytes.readInt();
indices[i] = bytes.readInt();
}
}
开发者ID:miuirussia,项目名称:KJBE,代码行数:21,代码来源:LOOKUPSWITCH.java
示例11: initFromFile
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Read needed data (e.g. index) from file.
* PRE: (ILOAD <= tag <= ALOAD_3) || (ISTORE <= tag <= ASTORE_3)
*/
protected void initFromFile(ByteSequence bytes, boolean wide)
throws IOException {
if (wide) {
n = bytes.readUnsignedShort();
length = 4;
} else if (((opcode >= Constants.ILOAD) &&
(opcode <= Constants.ALOAD)) ||
((opcode >= Constants.ISTORE) &&
(opcode <= Constants.ASTORE))) {
n = bytes.readUnsignedByte();
length = 2;
} else if (opcode <= Constants.ALOAD_3) { // compact load instruction such as ILOAD_2
n = (opcode - Constants.ILOAD_0) % 4;
length = 1;
} else { // Assert ISTORE_0 <= tag <= ASTORE_3
n = (opcode - Constants.ISTORE_0) % 4;
length = 1;
}
}
开发者ID:miuirussia,项目名称:KJBE,代码行数:24,代码来源:LocalVariableInstruction.java
示例12: codeToString
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Disassemble a byte array of JVM byte codes starting from code line
* `index' and return the disassembled string representation. Decode only
* `num' opcodes (including their operands), use -1 if you want to
* decompile everything.
*
* @param code byte code array
* @param constant_pool Array of constants
* @param index offset in `code' array
* <EM>(number of opcodes, not bytes!)</EM>
* @param length number of opcodes to decompile, -1 for all
* @param verbose be verbose, e.g. print constant pool index
* @return String representation of byte codes
*/
public static String codeToString(byte[] code,
ConstantPool constant_pool,
int index, int length, boolean verbose) {
StringBuffer buf = new StringBuffer(code.length * 20); // Should be sufficient
ByteSequence stream = new ByteSequence(code);
try {
for (int i = 0; i < index; i++) // Skip `index' lines of code
codeToString(stream, constant_pool, verbose);
for (int i = 0; stream.available() > 0; i++) {
if ((length < 0) || (i < length)) {
String indices = fillup(stream.getIndex() + ":", 6, true, ' ');
buf.append(indices).append(codeToString(stream, constant_pool, verbose)).append('\n');
}
}
} catch (IOException e) {
System.out.println(buf.toString());
e.printStackTrace();
throw new ClassFormatException("Byte code error: " + e);
}
return buf.toString();
}
开发者ID:miuirussia,项目名称:KJBE,代码行数:39,代码来源:Utility.java
示例13: initFromFile
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Read needed data (i.e., index) from file.
*/
protected void initFromFile(ByteSequence bytes, boolean wide)
throws IOException
{
setIndex(bytes.readUnsignedShort());
// Override just in case it has been changed
opcode = org.apache.bcel.Constants.LDC_W;
}
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:11,代码来源:LDC_W.java
示例14: initFromFile
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Read needed data (e.g. index) from file.
*/
protected void initFromFile(ByteSequence bytes, boolean wide)
throws IOException
{
length = 2;
index = bytes.readUnsignedByte();
}
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:10,代码来源:LDC.java
示例15: initFromFile
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Read needed data (e.g. index) from file.
*/
protected void initFromFile(ByteSequence bytes, boolean wide)
throws IOException {
padding = (4 - (bytes.getIndex() % 4)) % 4; // Compute number of pad
// bytes
for (int i = 0; i < padding; i++) {
bytes.readByte();
}
// Default branch target common for both cases (TABLESWITCH,
// LOOKUPSWITCH)
index = bytes.readInt();
}
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:17,代码来源:Select.java
示例16: initFromFile
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Read needed data (i.e., index) from file.
*/
protected void initFromFile(ByteSequence bytes, boolean wide)
throws IOException
{
super.initFromFile(bytes, wide);
length = 5;
nargs = bytes.readUnsignedByte();
bytes.readByte(); // Skip 0 byte
}
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:13,代码来源:INVOKEINTERFACE.java
示例17: initFromFile
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Read needed data (i.e., no. dimension) from file.
*/
protected void initFromFile(ByteSequence bytes, boolean wide)
throws IOException
{
super.initFromFile(bytes, wide);
dimensions = bytes.readByte();
length = 4;
}
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:11,代码来源:MULTIANEWARRAY.java
示例18: getInstructions
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* @return an array of instructions without target information for branch instructions.
*/
public Instruction[] getInstructions() {
ByteSequence bytes = new ByteSequence(getByteCode());
ArrayList<Instruction> instructions = new ArrayList<Instruction>();
try {
while(bytes.available() > 0) {
instructions.add(Instruction.readInstruction(bytes));
}
} catch(IOException e) { throw new ClassGenException(e.toString()); }
Instruction[] result = new Instruction[instructions.size()];
instructions.toArray(result);
return result;
}
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:18,代码来源:InstructionList.java
示例19: initFromFile
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Read needed data (e.g. index) from file.
*/
protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException
{
this.wide = wide;
if(wide) {
length = 6;
n = bytes.readUnsignedShort();
c = bytes.readShort();
} else {
length = 3;
n = bytes.readUnsignedByte();
c = bytes.readByte();
}
}
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:18,代码来源:IINC.java
示例20: initFromFile
import org.apache.bcel.util.ByteSequence; //导入依赖的package包/类
/**
* Read needed data (i.e., index) from file.
* @param bytes input stream
* @param wide wide prefix?
*/
protected void initFromFile(ByteSequence bytes, boolean wide)
throws IOException
{
setIndex(bytes.readUnsignedShort());
length = 3;
}
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:12,代码来源:CPInstruction.java
注:本文中的org.apache.bcel.util.ByteSequence类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论