com.google.common.primitives.UnsignedInteger Java Examples

The following examples show how to use com.google.common.primitives.UnsignedInteger. 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: FileHeaderTest.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws IOException {
    TestBinaryReaderBuilder testBinaryReaderBuilder = new TestBinaryReaderBuilder();
    testBinaryReaderBuilder.putString(FileHeader.ELF_FILE);
    testBinaryReaderBuilder.putQWord(oldestChunk);
    testBinaryReaderBuilder.putQWord(currentChunkNumber);
    testBinaryReaderBuilder.putQWord(nextRecordNumber);
    testBinaryReaderBuilder.putDWord(headerSize);
    testBinaryReaderBuilder.putWord(minorVersion);
    testBinaryReaderBuilder.putWord(majorVersion);
    testBinaryReaderBuilder.putWord(headerChunkSize);
    testBinaryReaderBuilder.putWord(chunkCount);
    byte[] unused = new byte[75];
    random.nextBytes(unused);
    testBinaryReaderBuilder.put(unused);
    testBinaryReaderBuilder.put((byte) 0);

    CRC32 crc32 = new CRC32();
    crc32.update(testBinaryReaderBuilder.toByteArray());

    testBinaryReaderBuilder.putDWord(flags);
    testBinaryReaderBuilder.putDWord(UnsignedInteger.valueOf(crc32.getValue()));

    fileHeader = new FileHeader(new ByteArrayInputStream(testBinaryReaderBuilder.toByteArray(4096)), mock(ComponentLog.class));
}
 
Example #2
Source File: TemplateInstanceNodeTest.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void testResidentTemplate() throws IOException {
    super.setup();
    testBinaryReaderBuilder.put(unknown);
    testBinaryReaderBuilder.putDWord(templateId);
    testBinaryReaderBuilder.putDWord(5);

    BinaryReader binaryReader = testBinaryReaderBuilder.build();
    TemplateNode templateNode = mock(TemplateNode.class);
    when(templateNode.getTemplateId()).thenReturn(UnsignedInteger.valueOf(templateId));
    when(templateNode.hasEndOfStream()).thenReturn(true).thenReturn(false);
    when(chunkHeader.addTemplateNode(5, binaryReader)).thenAnswer(invocation -> {
        binaryReader.skip(templateLength);
        return templateNode;
    });
    templateInstanceNode = new TemplateInstanceNode(binaryReader, chunkHeader, parent);
    assertEquals(templateLength, templateInstanceNode.getHeaderLength() - 10);
}
 
Example #3
Source File: operations.java    From AndroidWallet with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void write_to_encoder(base_encoder baseEncoder) {
    raw_type rawObject = new raw_type();
    baseEncoder.write(rawObject.get_byte(false));
    baseEncoder.write(rawObject.get_byte_array((long) account.get_instance()));
    LogUtils.i("modify_password---account", Arrays.toString(rawObject.get_byte_array((long) account.get_instance())));
    LogUtils.i("modify_password---owner", String.valueOf(rawObject.get_byte(owner != null)));
    baseEncoder.write(rawObject.get_byte(owner != null));
    owner.write_to_encode(baseEncoder);
    LogUtils.i("modify_password---active", String.valueOf(rawObject.get_byte(owner != null)));
    baseEncoder.write(rawObject.get_byte(active != null));
    active.write_to_encode(baseEncoder);
    baseEncoder.write(rawObject.get_byte(new_options != null));
    LogUtils.i("modify_password---new_options", String.valueOf(rawObject.get_byte(new_options != null)));
    if (new_options != null) {
        new_options.write_to_encode(baseEncoder);
    }
    rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(extensions.size()));
}
 
Example #4
Source File: TemplateInstanceNodeTest.java    From nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void testResidentTemplate() throws IOException {
    super.setup();
    testBinaryReaderBuilder.put(unknown);
    testBinaryReaderBuilder.putDWord(templateId);
    testBinaryReaderBuilder.putDWord(5);

    BinaryReader binaryReader = testBinaryReaderBuilder.build();
    TemplateNode templateNode = mock(TemplateNode.class);
    when(templateNode.getTemplateId()).thenReturn(UnsignedInteger.valueOf(templateId));
    when(chunkHeader.addTemplateNode(5, binaryReader)).thenAnswer(invocation -> {
        binaryReader.skip(templateLength);
        return templateNode;
    });
    templateInstanceNode = new TemplateInstanceNode(binaryReader, chunkHeader, parent);
    assertEquals(templateLength, templateInstanceNode.getHeaderLength() - 10);
}
 
Example #5
Source File: SIDTypeNode.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
public SIDTypeNode(BinaryReader binaryReader, ChunkHeader chunkHeader, BxmlNode parent, int length) throws IOException {
    super(binaryReader, chunkHeader, parent, length);
    int version = binaryReader.read();
    int num_elements = binaryReader.read();
    UnsignedInteger id_high = binaryReader.readDWordBE();
    int id_low = binaryReader.readWordBE();
    StringBuilder builder = new StringBuilder("S-");
    builder.append(version);
    builder.append("-");
    builder.append((id_high.longValue() << 16) ^ id_low);
    for (int i = 0; i < num_elements; i++) {
        builder.append("-");
        builder.append(binaryReader.readDWord());
    }
    value = builder.toString();
}
 
Example #6
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 #7
Source File: operations.java    From bitshares_wallet with MIT License 6 votes vote down vote up
@Override
public void write_to_encoder(base_encoder baseEncoder) {
    raw_type rawObject = new raw_type();

    // fee
    baseEncoder.write(rawObject.get_byte_array(fee.amount));
    rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(fee.asset_id.get_instance()));

    // fee_paying_account
    rawObject.pack(baseEncoder,
            UnsignedInteger.fromIntBits(fee_paying_account.get_instance()));

    // order
    rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(order.get_instance()));

    // extensions
    rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(extensions.size()));
}
 
Example #8
Source File: raw_type.java    From AndroidWallet 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 #9
Source File: transaction.java    From AndroidWallet with GNU General Public License v3.0 6 votes vote down vote up
public sha256_object sig_digest(sha256_object chain_id) {
    sha256_object.encoder enc = new sha256_object.encoder();
    enc.write(chain_id.hash, 0, chain_id.hash.length);
    raw_type rawTypeObject = new raw_type();
    enc.write(rawTypeObject.get_byte_array(ref_block_num.shortValue()));
    enc.write(rawTypeObject.get_byte_array(ref_block_prefix.intValue()));
    enc.write(rawTypeObject.get_byte_array(expiration));
    rawTypeObject.pack(enc, UnsignedInteger.fromIntBits(operations.size()));
    for (com.cocos.bcx_sdk.bcx_wallet.chain.operations.operation_type operationType : operations) {
        rawTypeObject.pack(enc, UnsignedInteger.fromIntBits(operationType.nOperationType));
        com.cocos.bcx_sdk.bcx_wallet.chain.operations.base_operation baseOperation = (com.cocos.bcx_sdk.bcx_wallet.chain.operations.base_operation) operationType.operationContent;
        baseOperation.write_to_encoder(enc);
    }
    rawTypeObject.pack(enc, UnsignedInteger.fromIntBits(extensions.size()));
    return enc.result();
}
 
Example #10
Source File: operations.java    From guarda-android-wallets with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void write_to_encoder(base_encoder baseEncoder) {
    raw_type rawObject = new raw_type();

    // fee
    baseEncoder.write(rawObject.get_byte_array(fee.amount));
    rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(fee.asset_id.get_instance()));

    // fee_paying_account
    rawObject.pack(baseEncoder,
            UnsignedInteger.fromIntBits(fee_paying_account.get_instance()));

    // order
    rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(order.get_instance()));

    // extensions
    rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(extensions.size()));
}
 
Example #11
Source File: FileHeaderTest.java    From nifi with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws IOException {
    TestBinaryReaderBuilder testBinaryReaderBuilder = new TestBinaryReaderBuilder();
    testBinaryReaderBuilder.putString(FileHeader.ELF_FILE);
    testBinaryReaderBuilder.putQWord(oldestChunk);
    testBinaryReaderBuilder.putQWord(currentChunkNumber);
    testBinaryReaderBuilder.putQWord(nextRecordNumber);
    testBinaryReaderBuilder.putDWord(headerSize);
    testBinaryReaderBuilder.putWord(minorVersion);
    testBinaryReaderBuilder.putWord(majorVersion);
    testBinaryReaderBuilder.putWord(headerChunkSize);
    testBinaryReaderBuilder.putWord(chunkCount);
    byte[] unused = new byte[75];
    random.nextBytes(unused);
    testBinaryReaderBuilder.put(unused);
    testBinaryReaderBuilder.put((byte) 0);

    CRC32 crc32 = new CRC32();
    crc32.update(testBinaryReaderBuilder.toByteArray());

    testBinaryReaderBuilder.putDWord(flags);
    testBinaryReaderBuilder.putDWord(UnsignedInteger.valueOf(crc32.getValue()));

    fileHeader = new FileHeader(new ByteArrayInputStream(testBinaryReaderBuilder.toByteArray(4096)), mock(ComponentLog.class));
}
 
Example #12
Source File: global_config_object.java    From AndroidWallet with GNU General Public License v3.0 6 votes vote down vote up
private global_config_object() {
    mGsonBuilder = new GsonBuilder();
    mGsonBuilder.registerTypeAdapter(types.public_key_type.class, new types.public_key_type_deserializer());
    mGsonBuilder.registerTypeAdapter(types.public_key_type.class, new types.public_type_serializer());
    mGsonBuilder.registerTypeAdapter(operations.operation_type.class, new operations.operation_type.operation_type_deserializer());
    mGsonBuilder.registerTypeAdapter(object_id.class, new object_id.object_id_deserializer());
    mGsonBuilder.registerTypeAdapter(object_id.class, new object_id.object_id_serializer());
    mGsonBuilder.registerTypeAdapter(ripe_md160_object.class, new ripe_md160_object.ripemd160_object_deserializer());
    mGsonBuilder.registerTypeAdapter(sha256_object.class, new sha256_object.sha256_object_deserializer());
    mGsonBuilder.registerTypeAdapter(types.vote_id_type.class, new types.vote_id_type_deserializer());
    mGsonBuilder.registerTypeAdapter(UnsignedLong.class, new unsigned_number_deserializer.UnsignedLongDeserialize());
    mGsonBuilder.registerTypeAdapter(Date.class, new gson_common_deserializer.DateDeserializer());
    mGsonBuilder.registerTypeAdapter(ByteBuffer.class, new gson_common_deserializer.ByteBufferDeserializer());
    mGsonBuilder.registerTypeAdapter(operations.operation_type.class, new operations.operation_type.operation_type_serializer());
    mGsonBuilder.registerTypeAdapter(compact_signature.class, new compact_signature.compact_signature_serializer());
    mGsonBuilder.registerTypeAdapter(UnsignedInteger.class, new unsigned_number_serializer.UnsigendIntegerSerializer());
    mGsonBuilder.registerTypeAdapter(unsigned_short.class, new unsigned_number_serializer.UnsigendShortSerializer());
    mGsonBuilder.registerTypeAdapter(Date.class, new gson_common_serializer.DateSerializer());
    mGsonBuilder.registerTypeAdapter(sha256_object.class, new sha256_object.sha256_object_serializer());
    mGsonBuilder.registerTypeAdapter(ByteBuffer.class, new gson_common_serializer.ByteBufferSerializer());
    mGsonBuilder.registerTypeAdapter(UnsignedLong.class, new unsigned_number_serializer.UnsignedLongSerializer());
}
 
Example #13
Source File: operations.java    From AndroidWallet with GNU General Public License v3.0 5 votes vote down vote up
@Override
        public void write_to_encoder(base_encoder baseEncoder) {
            raw_type rawObject = new raw_type();

            baseEncoder.write(rawObject.get_byte_array(committee_member_account.get_instance()));

//            rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(committee_member_account.get_instance()));
            rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(url.getBytes().length));
            baseEncoder.write(url.getBytes());
        }
 
Example #14
Source File: Transaction.java    From AndroidWallet with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the minimum nSequence number of all inputs
 * Can be used to detect transactions marked for Full-RBF and thus are very low trust while having 0 conf
 * Transactions with minSequenceNumber < MAX_INT-1 are eligible for full RBF
 * https://github.com/bitcoin/bitcoin/pull/6871#event-476297575
 *
 * @return the min nSequence of all inputs of that transaction
 */
public UnsignedInteger getMinSequenceNumber() {
   UnsignedInteger minVal = UnsignedInteger.MAX_VALUE;
   for (TransactionInput input : inputs) {
      UnsignedInteger nSequence = UnsignedInteger.fromIntBits(input.sequence);
      if (nSequence.compareTo(minVal) < 0) {
         minVal = nSequence;
      }
   }
   return minVal;
}
 
Example #15
Source File: Uint32Test.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testConversions() {
    assertSame(Uint32.valueOf(5), Uint32.valueOf(Uint8.valueOf(5)));
    assertSame(Uint32.valueOf(10), Uint32.valueOf(Uint16.valueOf(10)));
    assertSame(Uint32.valueOf(20), Uint32.valueOf(Uint64.valueOf(20)));

    assertSame(Uint32.valueOf(5), Uint32.valueOf(UnsignedInteger.fromIntBits(5)));
    assertEquals(UnsignedInteger.fromIntBits(5), Uint32.valueOf(5).toGuava());

    assertEquals(Uint8.TEN, Uint32.TEN.toUint8());
    assertEquals(Uint16.TEN, Uint32.TEN.toUint16());
    assertEquals(Uint64.valueOf(4294967295L), Uint32.MAX_VALUE.toUint64());
}
 
Example #16
Source File: TemplateNodeTest.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Test
public void testInit() {
    assertEquals(nextOffset, templateNode.getNextOffset());
    assertEquals(UnsignedInteger.valueOf(858927408), templateNode.getTemplateId());
    assertEquals(guid, templateNode.getGuid());
    assertEquals(dataLength, templateNode.getDataLength());
    assertTrue(templateNode.hasEndOfStream());
}
 
Example #17
Source File: VarInt.java    From bitherj with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the minimum encoded size of the given value.
 */
public static int sizeOf(long value) {
    if (isLessThanUnsigned(value, 253))
        return 1;
    else if (isLessThanUnsigned(value, 65536))
        return 3;  // 1 marker + 2 data bytes
    else if (isLessThanUnsigned(value, UnsignedInteger.MAX_VALUE.longValue()))
        return 5;  // 1 marker + 4 data bytes
    else
        return 9;  // 1 marker + 8 data bytes
}
 
Example #18
Source File: AbstractIntegerModifier.java    From snmpman with Apache License 2.0 5 votes vote down vote up
@Override
public void init(final ModifierProperties properties) {
    this.minimum = Optional.ofNullable(properties.getLong("minimum")).orElse(0L);
    this.maximum = Optional.ofNullable(properties.getLong("maximum")).orElse(UnsignedInteger.MAX_VALUE.longValue());

    this.minimumStep = Optional.ofNullable(properties.getLong("minimumStep")).orElse(0L);
    this.maximumStep = Optional.ofNullable(properties.getLong("maximumStep")).orElse(1L);

    Preconditions.checkArgument(minimum >= 0, "minimum should not be negative");
    Preconditions.checkArgument(maximum >= 0, "maximum should not be negative");

    Preconditions.checkArgument(minimum <= UnsignedInteger.MAX_VALUE.longValue(), "minimum should not exceed 2^32-1 (4294967295 decimal)");
    Preconditions.checkArgument(maximum <= UnsignedInteger.MAX_VALUE.longValue(), "maximum should not exceed 2^32-1 (4294967295 decimal)");
}
 
Example #19
Source File: BinaryReaderTest.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
@Test
public void testReadDWordBE() throws IOException {
    UnsignedInteger intValue = UnsignedInteger.fromIntBits(Integer.MAX_VALUE + 500);
    BinaryReader binaryReader = testBinaryReaderBuilder.putDWordBE(intValue).build();

    assertEquals(intValue, binaryReader.readDWordBE());
    assertEquals(4, binaryReader.getPosition());
}
 
Example #20
Source File: BinaryReaderTest.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Test
public void testReadDWord() throws IOException {
    UnsignedInteger intValue = UnsignedInteger.fromIntBits(Integer.MAX_VALUE + 500);
    BinaryReader binaryReader = testBinaryReaderBuilder.putDWord(intValue).build();

    assertEquals(intValue, binaryReader.readDWord());
    assertEquals(4, binaryReader.getPosition());
}
 
Example #21
Source File: Transaction.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns true if this transaction is marked for RBF and thus can easily get replaced by a
 * conflicting transaction while it is still unconfirmed.
 *
 * @return true if any of its inputs has a nSequence < MAX_INT-1
 */
public boolean isRbfAble() {
   if (_rbfAble == null){
      _rbfAble = (getMinSequenceNumber().compareTo(UnsignedInteger.MAX_VALUE.minus(UnsignedInteger.ONE)) < 0);
   }
   return _rbfAble;
}
 
Example #22
Source File: Bip44CoinType.java    From AndroidWallet with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected HdKeyPath knownChildFactory(UnsignedInteger index, boolean hardened) {
   if (hardened){
      return  new Bip44Account(this, index, true);
   }else{
      return new HdKeyPath(this, index, hardened);
   }
}
 
Example #23
Source File: operations.java    From bitshares_wallet with MIT License 5 votes vote down vote up
@Override
public void write_to_encoder(base_encoder baseEncoder) {
    raw_type rawObject = new raw_type();
    baseEncoder.write(rawObject.get_byte_array(fee.amount));
    //baseEncoder.write(rawObject.get_byte_array(fee.asset_id.get_instance()));
    rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(fee.asset_id.get_instance()));
    //baseEncoder.write(rawObject.get_byte_array(from.get_instance()));
    rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(from.get_instance()));
    //baseEncoder.write(rawObject.get_byte_array(to.get_instance()));
    rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(to.get_instance()));
    baseEncoder.write(rawObject.get_byte_array(amount.amount));
    //baseEncoder.write(rawObject.get_byte_array(amount.asset_id.get_instance()));
    rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(amount.asset_id.get_instance()));
    baseEncoder.write(rawObject.get_byte(memo != null));
    if (memo != null) {
        baseEncoder.write(memo.from.key_data);
        baseEncoder.write(memo.to.key_data);
        baseEncoder.write(rawObject.get_byte_array(memo.nonce));
        byte[] byteMessage = memo.message.array();
        rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(byteMessage.length));
        baseEncoder.write(byteMessage);
    }

    //baseEncoder.write(rawObject.get_byte_array(extensions.size()));
    rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(extensions.size()));

}
 
Example #24
Source File: unsigned_number_deserializer.java    From guarda-android-wallets with GNU General Public License v3.0 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 #25
Source File: wallet_api.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public static plain_keys from_input_stream(InputStream inputStream) {
    plain_keys keysResult = new plain_keys();
    keysResult.keys = new HashMap<>();
    keysResult.checksum = new sha512_object();

    raw_type rawType = new raw_type();
    UnsignedInteger size = rawType.unpack(inputStream);
    try {
        for (int i = 0; i < size.longValue(); ++i) {
            types.public_key_type publicKeyType = new types.public_key_type();
            inputStream.read(publicKeyType.key_data);

            UnsignedInteger strSize = rawType.unpack(inputStream);
            byte[] byteBuffer = new byte[strSize.intValue()];
            inputStream.read(byteBuffer);

            String strPrivateKey = new String(byteBuffer);

            keysResult.keys.put(publicKeyType, strPrivateKey);
        }

        inputStream.read(keysResult.checksum.hash);
    } catch (IOException e) {
        e.printStackTrace();
    }

    return keysResult;
}
 
Example #26
Source File: Bip44Chain.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected HdKeyPath knownChildFactory(UnsignedInteger index, boolean hardened) {
   if (!hardened){
      return  new Bip44Address(this, index, false);
   }else{
      return new HdKeyPath(this, index, hardened);
   }
}
 
Example #27
Source File: operations.java    From AndroidWallet with GNU General Public License v3.0 5 votes vote down vote up
@Override
        public void write_to_encoder(base_encoder baseEncoder) {
            raw_type rawObject = new raw_type();

            baseEncoder.write(rawObject.get_byte_array(publisher.get_instance()));
            baseEncoder.write(rawObject.get_byte_array(asset_id.get_instance()));

//            rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(publisher.get_instance()));
//            rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(asset_id.get_instance()));
            feed.write_to_encoder(baseEncoder, rawObject);
            rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(extensions.size()));
        }
 
Example #28
Source File: Bip44Account.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected HdKeyPath knownChildFactory(UnsignedInteger index, boolean hardened) {
   if (!hardened){
      return  new Bip44Chain(this, index, false);
   }else{
      return new HdKeyPath(this, index, hardened);
   }
}
 
Example #29
Source File: operations.java    From AndroidWallet with GNU General Public License v3.0 5 votes vote down vote up
@Override
        public void write_to_encoder(base_encoder baseEncoder) {
            raw_type rawObject = new raw_type();

            baseEncoder.write(rawObject.get_byte_array(account_to_upgrade.get_instance()));

//            rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(account_to_upgrade.get_instance()));
            baseEncoder.write(rawObject.get_byte(upgrade_to_lifetime_member));
            rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(extensions.size()));
        }
 
Example #30
Source File: operations.java    From AndroidWallet with GNU General Public License v3.0 5 votes vote down vote up
@Override
        public void write_to_encoder(base_encoder baseEncoder) {
            raw_type rawObject = new raw_type();
            baseEncoder.write(rawObject.get_byte_array(fee_paying_account.get_instance()));
            baseEncoder.write(rawObject.get_byte_array(order.get_instance()));
//            rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(fee_paying_account.get_instance()));
//            rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(order.get_instance()));
            rawObject.pack(baseEncoder, UnsignedInteger.fromIntBits(extensions.size()));
        }