Java Code Examples for com.google.common.primitives.UnsignedInteger#valueOf()

The following examples show how to use com.google.common.primitives.UnsignedInteger#valueOf() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NettyBsonDocumentWriter.java    From mongowp with Apache License 2.0 6 votes vote down vote up
@Override
public Void visit(BsonBinary value, ByteBuf arg) {
  NonIoByteSource byteSource = value.getByteSource();

  UnsignedInteger unsignedSize;
  unsignedSize = UnsignedInteger.valueOf(byteSource.size());

  arg.writeInt(unsignedSize.intValue()).writeByte(value.getNumericSubType());

  try (OutputStream os = new ByteBufOutputStream(arg)) {
    value.getByteSource().copyTo(os);
  } catch (IOException ex) {
    throw new AssertionError("Unexpected IOException", ex);
  }
  return null;
}
 
Example 2
Source File: raw_type.java    From guarda-android-wallets with GNU General Public License v3.0 6 votes vote down vote up
public UnsignedInteger unpack(InputStream inputStream) {
    long value = 0;
    int b = 0;
    int by = 0;

    try {
        do {
            b = inputStream.read();
            value |= (b & 0x7f) << by;
            by += 7;
        } while ((b & 0x80) > 0);
    } catch (IOException e) {
        e.printStackTrace();
    }

    return UnsignedInteger.valueOf(value);
}
 
Example 3
Source File: unsigned_number_deserializer.java    From bitshares_wallet with MIT License 5 votes vote down vote up
@Override
public UnsignedInteger deserialize(JsonElement json,
                                Type typeOfT,
                                JsonDeserializationContext context) throws JsonParseException {
    UnsignedInteger uIntegerObject = UnsignedInteger.valueOf(json.getAsString());

    return uIntegerObject;
}
 
Example 4
Source File: SillyEntity.java    From immutables with Apache License 2.0 4 votes vote down vote up
@Value.Derived
public UnsignedInteger der() {
  return UnsignedInteger.valueOf(1);
}
 
Example 5
Source File: Bip44Account.java    From guarda-android-wallets with GNU General Public License v3.0 4 votes vote down vote up
public Bip44Chain getChain(boolean external){
   return new Bip44Chain(this, UnsignedInteger.valueOf(external ? 0 : 1), false);
}
 
Example 6
Source File: Bip44Chain.java    From guarda-android-wallets with GNU General Public License v3.0 4 votes vote down vote up
public Bip44Address getAddress(int index){
   return new Bip44Address(this, UnsignedInteger.valueOf(index), false);
}
 
Example 7
Source File: Bip44Purpose.java    From guarda-android-wallets with GNU General Public License v3.0 4 votes vote down vote up
public Bip44CoinType getCoinTypeBitcoinTestnet(){
   return  new Bip44CoinType(this, UnsignedInteger.valueOf(1), true);
}
 
Example 8
Source File: Bip44Purpose.java    From guarda-android-wallets with GNU General Public License v3.0 4 votes vote down vote up
public Bip44CoinType getCoinTypeBitcoin(){
   return  new Bip44CoinType(this, UnsignedInteger.valueOf(0), true);
}
 
Example 9
Source File: HdKeyPath.java    From guarda-android-wallets with GNU General Public License v3.0 4 votes vote down vote up
public Bip44Purpose getBip44Purpose(){
   return new Bip44Purpose(this, UnsignedInteger.valueOf(44), true);
}
 
Example 10
Source File: HdKeyPath.java    From bitshares_wallet with MIT License 4 votes vote down vote up
public Bip44Purpose getBip44Purpose(){
   return new Bip44Purpose(this, UnsignedInteger.valueOf(44), true);
}
 
Example 11
Source File: Bip44Purpose.java    From bitshares_wallet with MIT License 4 votes vote down vote up
public Bip44CoinType getCoinTypeBitcoinTestnet(){
   return  new Bip44CoinType(this, UnsignedInteger.valueOf(1), true);
}
 
Example 12
Source File: Bip44Account.java    From AndroidWallet with GNU General Public License v3.0 4 votes vote down vote up
public Bip44Chain getChain(boolean external){
   return new Bip44Chain(this, UnsignedInteger.valueOf(external ? 0 : 1), false);
}
 
Example 13
Source File: Hex32TypeNodeTest.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Test
public void testHex32TypeNode() throws IOException {
    UnsignedInteger value = UnsignedInteger.valueOf(1234);
    String hex = value.toString(16);
    assertEquals(hex, new Hex32TypeNode(testBinaryReaderBuilder.putDWord(value).build(), chunkHeader, parent, -1).getValue().substring(2));
}
 
Example 14
Source File: Bip44Purpose.java    From AndroidWallet with GNU General Public License v3.0 4 votes vote down vote up
public Bip44CoinType getCoinTypeBitcoinTestnet(){
   return  new Bip44CoinType(this, UnsignedInteger.valueOf(1), true);
}
 
Example 15
Source File: Bip44Purpose.java    From AndroidWallet with GNU General Public License v3.0 4 votes vote down vote up
public Bip44CoinType getCoinTypeBitcoin(){
   return  new Bip44CoinType(this, UnsignedInteger.valueOf(0), true);
}
 
Example 16
Source File: Bip44CoinType.java    From guarda-android-wallets with GNU General Public License v3.0 4 votes vote down vote up
public Bip44Account getAccount(int id){
   return new Bip44Account(this, UnsignedInteger.valueOf(id), true);
}
 
Example 17
Source File: Bip44CoinType.java    From Upchain-wallet with GNU Affero General Public License v3.0 4 votes vote down vote up
public Bip44Account getAccount(int id){
   return new Bip44Account(this, UnsignedInteger.valueOf(id), true);
}
 
Example 18
Source File: Bip44Account.java    From Upchain-wallet with GNU Affero General Public License v3.0 4 votes vote down vote up
public Bip44Chain getChain(boolean external){
   return new Bip44Chain(this, UnsignedInteger.valueOf(external ? 0 : 1), false);
}
 
Example 19
Source File: Bip44Chain.java    From Upchain-wallet with GNU Affero General Public License v3.0 4 votes vote down vote up
public Bip44Address getAddress(int index){
   return new Bip44Address(this, UnsignedInteger.valueOf(index), false);
}
 
Example 20
Source File: Bip44Account.java    From bitshares_wallet with MIT License 4 votes vote down vote up
public Bip44Chain getChain(boolean external){
   return new Bip44Chain(this, UnsignedInteger.valueOf(external ? 0 : 1), false);
}