本文整理汇总了Java中com.google.common.primitives.Shorts.fromBytes方法的典型用法代码示例。如果您正苦于以下问题:Java Shorts.fromBytes方法的具体用法?Java Shorts.fromBytes怎么用?Java Shorts.fromBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.primitives.Shorts
的用法示例。
在下文中一共展示了Shorts.fromBytes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getShortFileOrder
import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
public int getShortFileOrder(byte[] buf, int offset) {
if (bigEndian) {
return Shorts.fromBytes(buf[offset], buf[offset + 1]);
} else {
return Shorts.fromBytes(buf[offset + 1], buf[offset]);
}
}
示例2: getShortFileOrder
import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
/**
*
* @param byteOrder true for forward file order, false fore revers file order
* @param buf byte buffer
* @param offset buffer offset
* @return short value as int of specific bytes from buffer
*/
public static int getShortFileOrder(boolean byteOrder, final byte[] buf, final int offset) {
if (byteOrder) {
return Shorts.fromBytes(buf[offset], buf[offset + 1]);
} else {
return Shorts.fromBytes(buf[offset + 1], buf[offset]);
}
}
示例3: decode
import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
private void decode(final byte[] rawData) {
lostPacketsReceiverA = Shorts.fromBytes(rawData[0x06], rawData[0x07]);
lostPacketsReceiverB = Shorts.fromBytes(rawData[0x08], rawData[0x09]);
lostPacketsReceiverL = Shorts.fromBytes(rawData[0x0A], rawData[0x0B]);
lostPacketsReceiverR = Shorts.fromBytes(rawData[0x0C], rawData[0x0D]);
frameLoss = Shorts.fromBytes(rawData[0x0E], rawData[0x0F]);
holds = Shorts.fromBytes(rawData[0x10], rawData[0x11]);
voltageInHunderthOfVolts = Shorts.fromBytes(rawData[0x12], rawData[0x13]);
}
示例4: decode
import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
private void decode(byte[] rawData) {
active = new Boolean((byte) 0x01 == rawData[7]);
minVoltageInHunderthOfVolts = Shorts.fromBytes(rawData[13], rawData[12]);
maxVoltageInHunderthOfVolts = Shorts.fromBytes(rawData[15], rawData[14]);
statusReport = new Byte(rawData[16]);
warningReport = new Byte(rawData[17]);
}
示例5: decode
import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
private void decode(final byte[] rawData) {
rawRpmData = Ints.fromBytes((byte) 0, (byte) 0, rawData[6], rawData[7]);
if (rawRpmData == 0) { // 0x0000
rpm = 0.0f;
} else {
rpm = (1.0f / rawRpmData * 120000000.0f) / ratioInHunderth * 100 / poles;
}
voltageInHunderthOfVolts = Shorts.fromBytes(rawData[8], rawData[9]);
tempInGradFahrenheit = Shorts.fromBytes(rawData[10], rawData[11]);
}
示例6: decode
import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
private void decode(byte[] rawData) {
rawECUStatus = rawData[6];
throttlePercentage = rawData[7];
packVoltage = (rawData[8] * 100D) + (rawData[9] / 100D);
pumpVoltage = (rawData[10] * 100D) + (rawData[11] / 100D);
rpm = Ints.fromBytes(rawData[12], rawData[13], rawData[14], rawData[15]);
egt = Shorts.fromBytes(rawData[16], rawData[17]);
rawOffCondition = rawData[18];
}
示例7: decode
import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
private void decode(byte[] rawData) {
xInHunderthOfG = Shorts.fromBytes(rawData[6], rawData[7]);
yInHunderthOfG = Shorts.fromBytes(rawData[8], rawData[9]);
zInHunderthOfG = Shorts.fromBytes(rawData[10], rawData[11]);
maxXInHunderthOfG = Shorts.fromBytes(rawData[12], rawData[13]);
maxYInHunderthOfG = Shorts.fromBytes(rawData[14], rawData[15]);
maxZInHunderthOfG = Shorts.fromBytes(rawData[16], rawData[17]);
minZInHunderthOfG = Shorts.fromBytes(rawData[18], rawData[19]);
}
示例8: decode
import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
private void decode(byte[] rawData) {
altitudeInTenthOfMeter = Shorts.fromBytes(rawData[0x06], rawData[0x07]);
deltaInIntervalOf250MsInTenthOfMeter = Shorts.fromBytes(rawData[0x08], rawData[0x09]);
deltaInIntervalOf500MsInTenthOfMeter = Shorts.fromBytes(rawData[0x0A], rawData[0x0B]);
deltaInIntervalOf1000MsInTenthOfMeter = Shorts.fromBytes(rawData[0x0C], rawData[0x0D]);
deltaInIntervalOf2000MsInTenthOfMeter = Shorts.fromBytes(rawData[0x0E], rawData[0x0F]);
deltaInIntervalOf3000MsInTenthOfMeter = Shorts.fromBytes(rawData[0x10], rawData[0x11]);
}
示例9: decode
import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
private void decode(byte[] rawData) {
poles = new Byte(rawData[6]);
active = new Boolean((byte) 0x01 == rawData[7]);
ratioInHunderth = Shorts.fromBytes(rawData[11], rawData[10]);
minRpm = Shorts.fromBytes(rawData[13], rawData[12]);
maxRpm = Shorts.fromBytes(rawData[15], rawData[14]);
statusReport = new Byte(rawData[16]);
warningReport = new Byte(rawData[17]);
}
示例10: getShort
import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
public int getShort(byte[] buf, int offset) {
return 0xffff & Shorts.fromBytes(buf[offset], buf[offset + 1]);
}
示例11: getShort
import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
public static int getShort(final byte[] buf, final int offset) {
return 0xffff & Shorts.fromBytes(buf[offset], buf[offset + 1]);
}
示例12: getMajorVersion
import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
/** Returns the major class file version */
public static short getMajorVersion(byte[] classData) {
// See http://en.wikipedia.org/wiki/Java_class_file
return Shorts.fromBytes(classData[6], classData[7]);
}
示例13: getMinorVersion
import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
/** Returns the minor class file version */
public static short getMinorVersion(byte[] classData) {
// See http://en.wikipedia.org/wiki/Java_class_file
return Shorts.fromBytes(classData[4], classData[5]);
}
示例14: decode
import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
private void decode(byte[] rawData) {
altitudeInTenthOfMeter = Shorts.fromBytes(rawData[6], rawData[7]);
}
示例15: decode
import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
private void decode(byte[] rawData) {
current = 0.1967f * Shorts.fromBytes(rawData[6], rawData[7]);
}