Java源码示例:com.android.dex.util.ByteInput
示例1
/**
* Reads an signed integer from {@code in}.
*/
public static int readSignedLeb128(ByteInput in) {
int result = 0;
int cur;
int count = 0;
int signBits = -1;
do {
cur = in.readByte() & 0xff;
result |= (cur & 0x7f) << (count * 7);
signBits <<= 7;
count++;
} while (((cur & 0x80) == 0x80) && count < 5);
if ((cur & 0x80) == 0x80) {
throw new DexException("invalid LEB128 sequence");
}
// Sign extend if appropriate
if (((signBits >> 1) & result) != 0 ) {
result |= signBits;
}
return result;
}
示例2
/**
* Reads an unsigned integer from {@code in}.
*/
public static int readUnsignedLeb128(ByteInput in) {
int result = 0;
int cur;
int count = 0;
do {
cur = in.readByte() & 0xff;
result |= (cur & 0x7f) << (count * 7);
count++;
} while (((cur & 0x80) == 0x80) && count < 5);
if ((cur & 0x80) == 0x80) {
throw new DexException("invalid LEB128 sequence");
}
return result;
}
示例3
/**
* Reads an signed integer from {@code in}.
*/
public static int readSignedLeb128(ByteInput in) {
int result = 0;
int cur;
int count = 0;
int signBits = -1;
do {
cur = in.readByte() & 0xff;
result |= (cur & 0x7f) << (count * 7);
signBits <<= 7;
count++;
} while (((cur & 0x80) == 0x80) && count < 5);
if ((cur & 0x80) == 0x80) {
throw new DexException("invalid LEB128 sequence");
}
// Sign extend if appropriate
if (((signBits >> 1) & result) != 0 ) {
result |= signBits;
}
return result;
}
示例4
/**
* Reads an unsigned integer from {@code in}.
*/
public static int readUnsignedLeb128(ByteInput in) {
int result = 0;
int cur;
int count = 0;
do {
cur = in.readByte() & 0xff;
result |= (cur & 0x7f) << (count * 7);
count++;
} while (((cur & 0x80) == 0x80) && count < 5);
if ((cur & 0x80) == 0x80) {
throw new DexException("invalid LEB128 sequence");
}
return result;
}
示例5
/**
* Reads an signed integer from {@code in}.
*/
public static int readSignedLeb128(ByteInput in) {
int result = 0;
int cur;
int count = 0;
int signBits = -1;
do {
cur = in.readByte() & 0xff;
result |= (cur & 0x7f) << (count * 7);
signBits <<= 7;
count++;
} while (((cur & 0x80) == 0x80) && count < 5);
if ((cur & 0x80) == 0x80) {
throw new DexException("invalid LEB128 sequence");
}
// Sign extend if appropriate
if (((signBits >> 1) & result) != 0 ) {
result |= signBits;
}
return result;
}
示例6
/**
* Reads an unsigned integer from {@code in}.
*/
public static int readUnsignedLeb128(ByteInput in) {
int result = 0;
int cur;
int count = 0;
do {
cur = in.readByte() & 0xff;
result |= (cur & 0x7f) << (count * 7);
count++;
} while (((cur & 0x80) == 0x80) && count < 5);
if ((cur & 0x80) == 0x80) {
throw new DexException("invalid LEB128 sequence");
}
return result;
}
示例7
/**
* Reads an signed integer from {@code in}.
*/
public static int readSignedLeb128(ByteInput in) {
int result = 0;
int cur;
int count = 0;
int signBits = -1;
do {
cur = in.readByte() & 0xff;
result |= (cur & 0x7f) << (count * 7);
signBits <<= 7;
count++;
} while (((cur & 0x80) == 0x80) && count < 5);
if ((cur & 0x80) == 0x80) {
throw new DexException("invalid LEB128 sequence");
}
// Sign extend if appropriate
if (((signBits >> 1) & result) != 0 ) {
result |= signBits;
}
return result;
}
示例8
/**
* Reads an unsigned integer from {@code in}.
*/
public static int readUnsignedLeb128(ByteInput in) {
int result = 0;
int cur;
int count = 0;
do {
cur = in.readByte() & 0xff;
result |= (cur & 0x7f) << (count * 7);
count++;
} while (((cur & 0x80) == 0x80) && count < 5);
if ((cur & 0x80) == 0x80) {
throw new DexException("invalid LEB128 sequence");
}
return result;
}
示例9
/**
* Reads an signed integer from {@code in}.
*/
public static int readSignedLeb128(ByteInput in) {
int result = 0;
int cur;
int count = 0;
int signBits = -1;
do {
cur = in.readByte() & 0xff;
result |= (cur & 0x7f) << (count * 7);
signBits <<= 7;
count++;
} while (((cur & 0x80) == 0x80) && count < 5);
if ((cur & 0x80) == 0x80) {
throw new DexException("invalid LEB128 sequence");
}
// Sign extend if appropriate
if (((signBits >> 1) & result) != 0 ) {
result |= signBits;
}
return result;
}
示例10
/**
* Reads an unsigned integer from {@code in}.
*/
public static int readUnsignedLeb128(ByteInput in) {
int result = 0;
int cur;
int count = 0;
do {
cur = in.readByte() & 0xff;
result |= (cur & 0x7f) << (count * 7);
count++;
} while (((cur & 0x80) == 0x80) && count < 5);
if ((cur & 0x80) == 0x80) {
throw new DexException("invalid LEB128 sequence");
}
return result;
}
示例11
/**
* Read a signed integer.
*
* @param zwidth byte count minus one
*/
public static int readSignedInt(ByteInput in, int zwidth) {
int result = 0;
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
}
result >>= (3 - zwidth) * 8;
return result;
}
示例12
/**
* Read an unsigned integer.
*
* @param zwidth byte count minus one
* @param fillOnRight true to zero fill on the right; false on the left
*/
public static int readUnsignedInt(ByteInput in, int zwidth, boolean fillOnRight) {
int result = 0;
if (!fillOnRight) {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
}
result >>>= (3 - zwidth) * 8;
} else {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
}
}
return result;
}
示例13
/**
* Read a signed long.
*
* @param zwidth byte count minus one
*/
public static long readSignedLong(ByteInput in, int zwidth) {
long result = 0;
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xffL) << 56);
}
result >>= (7 - zwidth) * 8;
return result;
}
示例14
/**
* Read an unsigned long.
*
* @param zwidth byte count minus one
* @param fillOnRight true to zero fill on the right; false on the left
*/
public static long readUnsignedLong(ByteInput in, int zwidth, boolean fillOnRight) {
long result = 0;
if (!fillOnRight) {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xffL) << 56);
}
result >>>= (7 - zwidth) * 8;
} else {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xffL) << 56);
}
}
return result;
}
示例15
/**
* Read a signed integer.
*
* @param zwidth byte count minus one
*/
public static int readSignedInt(ByteInput in, int zwidth) {
int result = 0;
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
}
result >>= (3 - zwidth) * 8;
return result;
}
示例16
/**
* Read an unsigned integer.
*
* @param zwidth byte count minus one
* @param fillOnRight true to zero fill on the right; false on the left
*/
public static int readUnsignedInt(ByteInput in, int zwidth, boolean fillOnRight) {
int result = 0;
if (!fillOnRight) {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
}
result >>>= (3 - zwidth) * 8;
} else {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
}
}
return result;
}
示例17
/**
* Read a signed long.
*
* @param zwidth byte count minus one
*/
public static long readSignedLong(ByteInput in, int zwidth) {
long result = 0;
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xffL) << 56);
}
result >>= (7 - zwidth) * 8;
return result;
}
示例18
/**
* Read an unsigned long.
*
* @param zwidth byte count minus one
* @param fillOnRight true to zero fill on the right; false on the left
*/
public static long readUnsignedLong(ByteInput in, int zwidth, boolean fillOnRight) {
long result = 0;
if (!fillOnRight) {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xffL) << 56);
}
result >>>= (7 - zwidth) * 8;
} else {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xffL) << 56);
}
}
return result;
}
示例19
/**
* Read a signed integer.
*
* @param zwidth byte count minus one
*/
public static int readSignedInt(ByteInput in, int zwidth) {
int result = 0;
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
}
result >>= (3 - zwidth) * 8;
return result;
}
示例20
/**
* Read an unsigned integer.
*
* @param zwidth byte count minus one
* @param fillOnRight true to zero fill on the right; false on the left
*/
public static int readUnsignedInt(ByteInput in, int zwidth, boolean fillOnRight) {
int result = 0;
if (!fillOnRight) {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
}
result >>>= (3 - zwidth) * 8;
} else {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
}
}
return result;
}
示例21
/**
* Read a signed long.
*
* @param zwidth byte count minus one
*/
public static long readSignedLong(ByteInput in, int zwidth) {
long result = 0;
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xffL) << 56);
}
result >>= (7 - zwidth) * 8;
return result;
}
示例22
/**
* Read an unsigned long.
*
* @param zwidth byte count minus one
* @param fillOnRight true to zero fill on the right; false on the left
*/
public static long readUnsignedLong(ByteInput in, int zwidth, boolean fillOnRight) {
long result = 0;
if (!fillOnRight) {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xffL) << 56);
}
result >>>= (7 - zwidth) * 8;
} else {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xffL) << 56);
}
}
return result;
}
示例23
/**
* Read a signed integer.
*
* @param zwidth byte count minus one
*/
public static int readSignedInt(ByteInput in, int zwidth) {
int result = 0;
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
}
result >>= (3 - zwidth) * 8;
return result;
}
示例24
/**
* Read an unsigned integer.
*
* @param zwidth byte count minus one
* @param fillOnRight true to zero fill on the right; false on the left
*/
public static int readUnsignedInt(ByteInput in, int zwidth, boolean fillOnRight) {
int result = 0;
if (!fillOnRight) {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
}
result >>>= (3 - zwidth) * 8;
} else {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
}
}
return result;
}
示例25
/**
* Read a signed long.
*
* @param zwidth byte count minus one
*/
public static long readSignedLong(ByteInput in, int zwidth) {
long result = 0;
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xffL) << 56);
}
result >>= (7 - zwidth) * 8;
return result;
}
示例26
/**
* Read an unsigned long.
*
* @param zwidth byte count minus one
* @param fillOnRight true to zero fill on the right; false on the left
*/
public static long readUnsignedLong(ByteInput in, int zwidth, boolean fillOnRight) {
long result = 0;
if (!fillOnRight) {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xffL) << 56);
}
result >>>= (7 - zwidth) * 8;
} else {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xffL) << 56);
}
}
return result;
}
示例27
/**
* Read a signed integer.
*
* @param zwidth byte count minus one
*/
public static int readSignedInt(ByteInput in, int zwidth) {
int result = 0;
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
}
result >>= (3 - zwidth) * 8;
return result;
}
示例28
/**
* Read an unsigned integer.
*
* @param zwidth byte count minus one
* @param fillOnRight true to zero fill on the right; false on the left
*/
public static int readUnsignedInt(ByteInput in, int zwidth, boolean fillOnRight) {
int result = 0;
if (!fillOnRight) {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
}
result >>>= (3 - zwidth) * 8;
} else {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xff) << 24);
}
}
return result;
}
示例29
/**
* Read a signed long.
*
* @param zwidth byte count minus one
*/
public static long readSignedLong(ByteInput in, int zwidth) {
long result = 0;
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xffL) << 56);
}
result >>= (7 - zwidth) * 8;
return result;
}
示例30
/**
* Read an unsigned long.
*
* @param zwidth byte count minus one
* @param fillOnRight true to zero fill on the right; false on the left
*/
public static long readUnsignedLong(ByteInput in, int zwidth, boolean fillOnRight) {
long result = 0;
if (!fillOnRight) {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xffL) << 56);
}
result >>>= (7 - zwidth) * 8;
} else {
for (int i = zwidth; i >= 0; i--) {
result = (result >>> 8) | ((in.readByte() & 0xffL) << 56);
}
}
return result;
}