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


Java UnsignedBytes.MAX_VALUE屬性代碼示例

本文整理匯總了Java中com.google.common.primitives.UnsignedBytes.MAX_VALUE屬性的典型用法代碼示例。如果您正苦於以下問題:Java UnsignedBytes.MAX_VALUE屬性的具體用法?Java UnsignedBytes.MAX_VALUE怎麽用?Java UnsignedBytes.MAX_VALUE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.google.common.primitives.UnsignedBytes的用法示例。


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

示例1: prefixNext

/**
 * The next key for bytes domain It first plus one at LSB and if LSB overflows, a zero byte is
 * appended at the end Original bytes will be reused if possible
 *
 * @param key key to encode
 * @return encoded results
 */
public static byte[] prefixNext(byte[] key) {
  int i;
  for (i = key.length - 1; i >= 0; i--) {
    if (key[i] != UnsignedBytes.MAX_VALUE) {
      key[i]++;
      break;
    }
  }
  if (i == -1) {
    return getNextKeyInByteOrder(key);
  }
  return key;
}
 
開發者ID:pingcap,項目名稱:tikv-client-lib-java,代碼行數:20,代碼來源:KeyUtils.java

示例2: increment

/**
 * Returns a RandomAccessData that is the smallest value of same length which
 * is strictly greater than this. Note that if this is empty or is all 0xFF then
 * a token value of positive infinity is returned.
 *
 * <p>The {@link UnsignedLexicographicalComparator} supports comparing {@link RandomAccessData}
 * with support for positive infinitiy.
 */
public RandomAccessData increment() throws IOException {
  RandomAccessData copy = copy();
  for (int i = copy.size - 1; i >= 0; --i) {
    if (copy.buffer[i] != UnsignedBytes.MAX_VALUE) {
      copy.buffer[i] = UnsignedBytes.checkedCast(UnsignedBytes.toInt(copy.buffer[i]) + 1);
      return copy;
    }
  }
  return POSITIVE_INFINITY;
}
 
開發者ID:apache,項目名稱:beam,代碼行數:18,代碼來源:RandomAccessData.java

示例3: testMessageUtil

@Test
public void testMessageUtil() {
    final byte[] result = new byte[] { UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE,
        UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE,
        UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE,
        UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, UnsignedBytes.MAX_VALUE, 0, 23, 3, 32, 5, 14, 21 };
    final ByteBuf formattedMessage = Unpooled.buffer();
    MessageUtil.formatMessage(3, Unpooled.wrappedBuffer(new byte[] { 32, 5, 14, 21 }), formattedMessage);
    assertArrayEquals(result, ByteArray.getAllBytes(formattedMessage));
}
 
開發者ID:opendaylight,項目名稱:bgpcep,代碼行數:10,代碼來源:UtilsTest.java

示例4: decrement

/**
 * Performs an arbitrary-precision decrement of a byte array.
 *
 * @param in The array to decrement.
 * @return The same input array.
 */
@Nonnull
public static byte[] decrement(@Nonnull byte[] in) {
    for (int i = in.length - 1; i >= 0; i--) {
        if (UnsignedBytes.toInt(in[i]) > 0) {
            in[i]--;
            break;
        }
        in[i] = UnsignedBytes.MAX_VALUE;
    }

    return in;
}
 
開發者ID:shevek,項目名稱:dhcp4j,代碼行數:18,代碼來源:AddressUtils.java

示例5: getBsonType

/**
 * Translate a byte to the {@link BsonType} it represents, as specified on the
 * <a href="http://bsonspec.org/spec.html">BSON Spec</a>
 *
 * @param typeByte
 * @return
 * @throws NettyBsonReaderException
 */
@Nonnull
protected static BsonType getBsonType(byte typeByte) throws NettyBsonReaderException {
  switch (typeByte) {
    case 0x01:
      return DOUBLE;
    case 0x02:
      return STRING;
    case 0x03:
      return DOCUMENT;
    case 0x04:
      return ARRAY;
    case 0x05:
      return BINARY;
    case 0x06:
      return UNDEFINED;
    case 0x07:
      return OBJECT_ID;
    case 0x08:
      return BOOLEAN;
    case 0x09:
      return DATETIME;
    case 0x0A:
      return NULL;
    case 0x0B:
      return REGEX;
    case 0x0C:
      return DB_POINTER;
    case 0x0D:
      return JAVA_SCRIPT;
    case 0x0E:
      return DEPRECATED;
    case 0x0F:
      return JAVA_SCRIPT_WITH_SCOPE;
    case 0x10:
      return INT32;
    case 0x11:
      return TIMESTAMP;
    case 0x12:
      return INT64;
    case 0x13:
      return DECIMAL128;
    case UnsignedBytes.MAX_VALUE:
      return MIN;
    case 0x7F:
      return MAX;
    default:
      throw new NettyBsonReaderException("It is not defined the type associated with the byte "
          + UnsignedBytes.toString(typeByte, 16));
  }
}
 
開發者ID:torodb,項目名稱:mongowp,代碼行數:58,代碼來源:ParsingTools.java

示例6: getByte

protected static byte getByte(BsonType bsonType) throws NettyBsonReaderException {
  switch (bsonType) {
    case DOUBLE:
      return 0x01;
    case STRING:
      return 0x02;
    case DOCUMENT:
      return 0x03;
    case ARRAY:
      return 0x04;
    case BINARY:
      return 0x05;
    case UNDEFINED:
      return 0x06;
    case OBJECT_ID:
      return 0x07;
    case BOOLEAN:
      return 0x08;
    case DATETIME:
      return 0x09;
    case NULL:
      return 0x0A;
    case REGEX:
      return 0x0B;
    case DB_POINTER:
      return 0x0C;
    case JAVA_SCRIPT:
      return 0x0D;
    case DEPRECATED:
      return 0x0E;
    case JAVA_SCRIPT_WITH_SCOPE:
      return 0x0F;
    case INT32:
      return 0x10;
    case TIMESTAMP:
      return 0x11;
    case INT64:
      return 0x12;
    case DECIMAL128:
      return 0x13;
    case MIN:
      return UnsignedBytes.MAX_VALUE;
    case MAX:
      return 0x7F;
    default:
      throw new NettyBsonReaderException("It is not defined the byte associated with the type "
          + bsonType);
  }
}
 
開發者ID:torodb,項目名稱:mongowp,代碼行數:49,代碼來源:ParsingTools.java


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