当前位置: 首页>>代码示例>>Java>>正文


Java Shorts.fromBytes方法代码示例

本文整理汇总了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]);
    }
}
 
开发者ID:tdunning,项目名称:pcap-filter,代码行数:8,代码来源:PacketDecoder.java

示例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]);
  }
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:15,代码来源:PcapFormatUtils.java

示例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]);
}
 
开发者ID:mikejr83,项目名称:TLMReaderLib,代码行数:10,代码来源:RXBlock.java

示例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]);
}
 
开发者ID:mikejr83,项目名称:TLMReaderLib,代码行数:8,代码来源:HeaderVoltBlock.java

示例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]);
}
 
开发者ID:mikejr83,项目名称:TLMReaderLib,代码行数:11,代码来源:StandardBlock.java

示例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];
}
 
开发者ID:mikejr83,项目名称:TLMReaderLib,代码行数:10,代码来源:JetCat.java

示例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]);
}
 
开发者ID:mikejr83,项目名称:TLMReaderLib,代码行数:10,代码来源:GForceBlock.java

示例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]);
}
 
开发者ID:mikejr83,项目名称:TLMReaderLib,代码行数:9,代码来源:VarioBlock.java

示例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]);
}
 
开发者ID:mikejr83,项目名称:TLMReaderLib,代码行数:10,代码来源:HeaderRpmBlock.java

示例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]);
}
 
开发者ID:tdunning,项目名称:pcap-filter,代码行数:4,代码来源:PacketDecoder.java

示例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]);
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:4,代码来源:PcapFormatUtils.java

示例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]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ClassConverter.java

示例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]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ClassConverter.java

示例14: decode

import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
private void decode(byte[] rawData) {
	altitudeInTenthOfMeter = Shorts.fromBytes(rawData[6], rawData[7]);
}
 
开发者ID:mikejr83,项目名称:TLMReaderLib,代码行数:4,代码来源:AltitudeBlock.java

示例15: decode

import com.google.common.primitives.Shorts; //导入方法依赖的package包/类
private void decode(byte[] rawData) {
	current = 0.1967f * Shorts.fromBytes(rawData[6], rawData[7]);
}
 
开发者ID:mikejr83,项目名称:TLMReaderLib,代码行数:4,代码来源:CurrentBlock.java


注:本文中的com.google.common.primitives.Shorts.fromBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。