當前位置: 首頁>>代碼示例>>Java>>正文


Java MutableInt.add方法代碼示例

本文整理匯總了Java中org.apache.commons.lang3.mutable.MutableInt.add方法的典型用法代碼示例。如果您正苦於以下問題:Java MutableInt.add方法的具體用法?Java MutableInt.add怎麽用?Java MutableInt.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.lang3.mutable.MutableInt的用法示例。


在下文中一共展示了MutableInt.add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: deserializeLong

import org.apache.commons.lang3.mutable.MutableInt; //導入方法依賴的package包/類
/**
 * This method deserializes a long from the given byte array from the given offset,
 * and increments the offset appropriately.
 * @param buffer The byte buffer to deserialize from.
 * @param offset The offset to deserialize from.
 * @return The deserialized long.
 */
public static long deserializeLong(byte[] buffer, MutableInt offset)
{
  int offsetInt = offset.intValue();
  long val = ((((long)buffer[0 + offsetInt]) & 0xFFL) << 56) |
      ((((long)buffer[1 + offsetInt]) & 0xFFL) << 48) |
      ((((long)buffer[2 + offsetInt]) & 0xFFL) << 40) |
      ((((long)buffer[3 + offsetInt]) & 0xFFL) << 32) |
      ((((long)buffer[4 + offsetInt]) & 0xFFL) << 24) |
      ((((long)buffer[5 + offsetInt]) & 0xFFL) << 16) |
      ((((long)buffer[6 + offsetInt]) & 0xFFL) << 8) |
      (((long)buffer[7 + offsetInt]) & 0xFFL);

  offset.add(Type.LONG.getByteSize());
  return val;
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:23,代碼來源:GPOUtils.java

示例2: deserializeDouble

import org.apache.commons.lang3.mutable.MutableInt; //導入方法依賴的package包/類
/**
 * This method deserializes a double from the given byte array from the given offset,
 * and increments the offset appropriately.
 * @param buffer The byte buffer to deserialize from.
 * @param offset The offset to deserialize from.
 * @return The deserialized double.
 */
public static double deserializeDouble(byte[] buffer, MutableInt offset)
{
  int offsetInt = offset.intValue();
  long val = (((long)buffer[0 + offsetInt]) & 0xFFL) << 56 |
      ((((long)buffer[1 + offsetInt]) & 0xFFL) << 48) |
      ((((long)buffer[2 + offsetInt]) & 0xFFL) << 40) |
      ((((long)buffer[3 + offsetInt]) & 0xFFL) << 32) |
      ((((long)buffer[4 + offsetInt]) & 0xFFL) << 24) |
      ((((long)buffer[5 + offsetInt]) & 0xFFL) << 16) |
      ((((long)buffer[6 + offsetInt]) & 0xFFL) << 8) |
      (((long)buffer[7 + offsetInt]) & 0xFFL);

  offset.add(Type.DOUBLE.getByteSize());
  return Double.longBitsToDouble(val);
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:23,代碼來源:GPOUtils.java

示例3: serializeDouble

import org.apache.commons.lang3.mutable.MutableInt; //導入方法依賴的package包/類
/**
 * This method serializes the given double to the given byte buffer to the given offset,
 * the method also increments the offset appropriately.
 * @param valD The value to serialize.
 * @param buffer The byte buffer to serialize to.
 * @param offset The offset in the buffer to serialize to and also to increment appropriately.
 */
public static void serializeDouble(double valD, byte[] buffer, MutableInt offset)
{
  long val = Double.doubleToLongBits(valD);

  int offsetInt = offset.intValue();
  buffer[0 + offsetInt] = (byte)((val >> 56) & 0xFFL);
  buffer[1 + offsetInt] = (byte)((val >> 48) & 0xFFL);
  buffer[2 + offsetInt] = (byte)((val >> 40) & 0xFFL);
  buffer[3 + offsetInt] = (byte)((val >> 32) & 0xFFL);
  buffer[4 + offsetInt] = (byte)((val >> 24) & 0xFFL);
  buffer[5 + offsetInt] = (byte)((val >> 16) & 0xFFL);
  buffer[6 + offsetInt] = (byte)((val >> 8) & 0xFFL);
  buffer[7 + offsetInt] = (byte)(val & 0xFFL);

  offset.add(Type.DOUBLE.getByteSize());
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:24,代碼來源:GPOUtils.java

示例4: deserializeString

import org.apache.commons.lang3.mutable.MutableInt; //導入方法依賴的package包/類
/**
 * This method deserializes a string from the given byte array from the given offset,
 * and increments the offset appropriately.
 * @param buffer The byte buffer to deserialize from.
 * @param offset The offset to deserialize from.
 * @return The deserialized string.
 */
public static String deserializeString(byte[] buffer, MutableInt offset)
{
  int length = deserializeInt(buffer, offset);

  String val = new String(buffer, offset.intValue(), length);
  offset.add(length);
  return val;
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:16,代碼來源:GPOUtils.java

示例5: serializeString

import org.apache.commons.lang3.mutable.MutableInt; //導入方法依賴的package包/類
/**
 * This method serializes the given string to the given byte buffer to the given offset,
 * the method also increments the offset appropriately.
 * @param val The value to serialize.
 * @param buffer The byte buffer to serialize to.
 * @param offset The offset in the buffer to serialize to and also to increment appropriately.
 */
public static void serializeString(String val, byte[] buffer, MutableInt offset)
{
  byte[] stringBytes = val.getBytes();
  int length = stringBytes.length;

  serializeInt(length, buffer, offset);

  for (int index = 0; index < length; index++) {
    buffer[offset.intValue() + index] = stringBytes[index];
  }

  offset.add(length);
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:21,代碼來源:GPOUtils.java

示例6: serializeLong

import org.apache.commons.lang3.mutable.MutableInt; //導入方法依賴的package包/類
/**
 * This method serializes the given long to the given byte buffer to the given offset,
 * the method also increments the offset appropriately.
 * @param val The value to serialize.
 * @param buffer The byte buffer to serialize to.
 * @param offset The offset in the buffer to serialize to and also to increment appropriately.
 */
public static void serializeLong(long val, byte[] buffer, MutableInt offset)
{
  int offsetInt = offset.intValue();
  buffer[0 + offsetInt] = (byte)((val >> 56) & 0xFFL);
  buffer[1 + offsetInt] = (byte)((val >> 48) & 0xFFL);
  buffer[2 + offsetInt] = (byte)((val >> 40) & 0xFFL);
  buffer[3 + offsetInt] = (byte)((val >> 32) & 0xFFL);
  buffer[4 + offsetInt] = (byte)((val >> 24) & 0xFFL);
  buffer[5 + offsetInt] = (byte)((val >> 16) & 0xFFL);
  buffer[6 + offsetInt] = (byte)((val >> 8) & 0xFFL);
  buffer[7 + offsetInt] = (byte)(val & 0xFFL);

  offset.add(Type.LONG.getByteSize());
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:22,代碼來源:GPOUtils.java

示例7: deserializeInt

import org.apache.commons.lang3.mutable.MutableInt; //導入方法依賴的package包/類
/**
 * This method deserializes an integer from the given byte array from the given offset,
 * and increments the offset appropriately.
 * @param buffer The byte buffer to deserialize from.
 * @param offset The offset to deserialize from.
 * @return The deserialized integer.
 */
public static int deserializeInt(byte[] buffer, MutableInt offset)
{
  int offsetInt = offset.intValue();
  int val = ((((int)buffer[0 + offsetInt]) & 0xFF) << 24) |
      ((((int)buffer[1 + offsetInt]) & 0xFF) << 16) |
      ((((int)buffer[2 + offsetInt]) & 0xFF) << 8) |
      (((int)buffer[3 + offsetInt]) & 0xFF);

  offset.add(Type.INTEGER.getByteSize());
  return val;
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:19,代碼來源:GPOUtils.java

示例8: serializeInt

import org.apache.commons.lang3.mutable.MutableInt; //導入方法依賴的package包/類
/**
 * This method serializes the given integer to the given byte buffer to the given offset,
 * the method also increments the offset appropriately.
 * @param val The value to serialize.
 * @param buffer The byte buffer to serialize to.
 * @param offset The offset in the buffer to serialize to and also to increment appropriately.
 */
public static void serializeInt(int val, byte[] buffer, MutableInt offset)
{
  int offsetInt = offset.intValue();
  buffer[0 + offsetInt] = (byte)((val >> 24) & 0xFF);
  buffer[1 + offsetInt] = (byte)((val >> 16) & 0xFF);
  buffer[2 + offsetInt] = (byte)((val >> 8) & 0xFF);
  buffer[3 + offsetInt] = (byte)(val & 0xFF);

  offset.add(Type.INTEGER.getByteSize());
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:18,代碼來源:GPOUtils.java

示例9: deserializeFloat

import org.apache.commons.lang3.mutable.MutableInt; //導入方法依賴的package包/類
/**
 * This method deserializes a float from the given byte array from the given offset,
 * and increments the offset appropriately.
 * @param buffer The byte buffer to deserialize from.
 * @param offset The offset to deserialize from.
 * @return The deserialized float.
 */
public static float deserializeFloat(byte[] buffer, MutableInt offset)
{
  int offsetInt = offset.intValue();
  int val = ((((int)buffer[0 + offsetInt]) & 0xFF) << 24) |
      ((((int)buffer[1 + offsetInt]) & 0xFF) << 16) |
      ((((int)buffer[2 + offsetInt]) & 0xFF) << 8) |
      (((int)buffer[3 + offsetInt]) & 0xFF);

  offset.add(Type.FLOAT.getByteSize());
  return Float.intBitsToFloat(val);
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:19,代碼來源:GPOUtils.java

示例10: serializeFloat

import org.apache.commons.lang3.mutable.MutableInt; //導入方法依賴的package包/類
/**
 * This method serializes the given float to the given byte buffer to the given offset,
 * the method also increments the offset appropriately.
 * @param valf The value to serialize.
 * @param buffer The byte buffer to serialize to.
 * @param offset The offset in the buffer to serialize to and also to increment appropriately.
 */
public static void serializeFloat(float valf, byte[] buffer, MutableInt offset)
{
  int offsetInt = offset.intValue();
  int val = Float.floatToIntBits(valf);

  buffer[0 + offsetInt] = (byte)((val >> 24) & 0xFF);
  buffer[1 + offsetInt] = (byte)((val >> 16) & 0xFF);
  buffer[2 + offsetInt] = (byte)((val >> 8) & 0xFF);
  buffer[3 + offsetInt] = (byte)(val & 0xFF);

  offset.add(Type.FLOAT.getByteSize());
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:20,代碼來源:GPOUtils.java

示例11: deserializeShort

import org.apache.commons.lang3.mutable.MutableInt; //導入方法依賴的package包/類
/**
 * This method deserializes a short from the given byte array from the given offset,
 * and increments the offset appropriately.
 * @param buffer The byte buffer to deserialize from.
 * @param offset The offset to deserialize from.
 * @return The deserialized short.
 */
public static short deserializeShort(byte[] buffer, MutableInt offset)
{
  int offsetInt = offset.intValue();
  short val = (short)(((((int)buffer[0 + offsetInt]) & 0xFF) << 8) |
      (((int)buffer[1 + offsetInt]) & 0xFF));

  offset.add(Type.SHORT.getByteSize());
  return val;
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:17,代碼來源:GPOUtils.java

示例12: serializeShort

import org.apache.commons.lang3.mutable.MutableInt; //導入方法依賴的package包/類
/**
 * This method serializes the given short to the given byte buffer to the given offset,
 * the method also increments the offset appropriately.
 * @param val The value to serialize.
 * @param buffer The byte buffer to serialize to.
 * @param offset The offset in the buffer to serialize to and also to increment appropriately.
 */
public static void serializeShort(short val, byte[] buffer, MutableInt offset)
{
  int offsetInt = offset.intValue();
  buffer[0 + offsetInt] = (byte)((val >> 8) & 0xFF);
  buffer[1 + offsetInt] = (byte)(val & 0xFF);

  offset.add(Type.SHORT.getByteSize());
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:16,代碼來源:GPOUtils.java

示例13: deserializeByte

import org.apache.commons.lang3.mutable.MutableInt; //導入方法依賴的package包/類
/**
 * This method deserializes a byte from the given byte array from the given offset,
 * and increments the offset appropriately.
 * @param buffer The byte buffer to deserialize from.
 * @param offset The offset to deserialize from.
 * @return The deserialized byte.
 */
public static byte deserializeByte(byte[] buffer, MutableInt offset)
{
  byte val = buffer[offset.intValue()];

  offset.add(Type.BYTE.getByteSize());
  return val;
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:15,代碼來源:GPOUtils.java

示例14: deserializeBoolean

import org.apache.commons.lang3.mutable.MutableInt; //導入方法依賴的package包/類
/**
 * This method deserializes a boolean from the given byte array from the given offset,
 * and increments the offset appropriately.
 * @param buffer The byte buffer to deserialize from.
 * @param offset The offset to deserialize from.
 * @return The deserialized boolean.
 */
public static boolean deserializeBoolean(byte[] buffer, MutableInt offset)
{
  boolean val = buffer[offset.intValue()] != 0;

  offset.add(Type.BOOLEAN.getByteSize());
  return val;
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:15,代碼來源:GPOUtils.java

示例15: serializeChar

import org.apache.commons.lang3.mutable.MutableInt; //導入方法依賴的package包/類
/**
 * This method serializes the given character to the given byte buffer to the given offset,
 * the method also increments the offset appropriately.
 * @param val The value to serialize.
 * @param buffer The byte buffer to serialize to.
 * @param offset The offset in the buffer to serialize to and also to increment appropriately.
 */
public static void serializeChar(char val, byte[] buffer, MutableInt offset)
{
  int offsetInt = offset.intValue();
  buffer[0 + offsetInt] = (byte)((val >> 8) & 0xFF);
  buffer[1 + offsetInt] = (byte)(val & 0xFF);

  offset.add(Type.CHAR.getByteSize());
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:16,代碼來源:GPOUtils.java


注:本文中的org.apache.commons.lang3.mutable.MutableInt.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。