public class SerializationUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static int |
byteToUnsignedInt(byte value)
It converts a signed byte to a positive integer.
|
static byte[] |
concat(byte[] commonBytes,
byte[] transactionBytes)
It concats the 2 byte arrays patching the int size at the beginning of the first byte array
setting up the sum of both lengths.
|
static java.nio.ByteBuffer |
fromAddressToByteBuffer(Address resolvedAddress)
It serializes an resolved
Address into a ByteBuffer |
static java.nio.ByteBuffer |
fromUnresolvedAddressToByteBuffer(UnresolvedAddress unresolvedAddress,
NetworkType networkType)
It serializes a
UnresolvedAddress to an hex catbuffer understand. |
static java.util.EnumSet<io.nem.symbol.catapult.builders.MosaicFlagsDto> |
getMosaicFlagsEnumSet(MosaicFlags flags)
Get the mosaic flags.
|
static long |
intToUnsignedLong(int value)
It converts a signed int to a positive long.
|
static int |
shortToUnsignedInt(short value)
It converts a signed short to a positive integer.
|
static Address |
toAddress(io.nem.symbol.catapult.builders.AddressDto dto)
It creates a
Address from an AddressDto . |
static io.nem.symbol.catapult.builders.AddressDto |
toAddressDto(Address resolvedAddress)
It serializes an resolved
Address into a ByteBuffer |
static io.nem.symbol.catapult.builders.AmountDto |
toAmount(java.math.BigInteger amount)
Converts an amount to a catbuffer
AmountDto |
static java.nio.ByteBuffer |
toByteBuffer(PublicAccount publicAccount)
It serializes the public key of a public account.
|
static java.io.DataInputStream |
toDataInput(byte[] payload)
It creates a
DataInputStream from a binary payload. |
static io.nem.symbol.catapult.builders.FinalizationEpochDto |
toFinalizationEpochDto(long finalizationEpoch) |
static io.nem.symbol.catapult.builders.Hash256Dto |
toHash256Dto(java.lang.String hash)
It creates a catbuffer Hash256Dto from a String hash.
|
static java.lang.String |
toHexString(java.nio.ByteBuffer buffer)
It extracts the hex string from the
ByteBuffer |
static java.lang.String |
toHexString(io.nem.symbol.catapult.builders.Hash256Dto dto)
It extracts the hex string from the
Hash256Dto |
static io.nem.symbol.catapult.builders.KeyDto |
toKeyDto(PublicKey publicKey)
It creates a catbuffer KeyDto from a
PublicKey . |
static Mosaic |
toMosaic(io.nem.symbol.catapult.builders.UnresolvedMosaicBuilder builder)
It creates a Mosaic from an
UnresolvedMosaicBuilder . |
static java.util.List<io.nem.symbol.catapult.builders.MosaicBuilder> |
toMosaicBuilders(java.util.List<ResolvedMosaic> mosaics)
Converts resolved mosaic list to mosaic builder list to serialize
|
static MosaicId |
toMosaicId(io.nem.symbol.catapult.builders.MosaicIdDto dto)
It creates a
MosaicId from an MosaicIdDto . |
static io.nem.symbol.catapult.builders.MosaicIdDto |
toMosaicIdDto(MosaicId mosaicId)
Converts an a model
MosaicId into an MosaicIdDto from catbuffer. |
static NamespaceId |
toNamespaceId(io.nem.symbol.catapult.builders.NamespaceIdDto dto)
It creates a
NamespaceId from an NamespaceIdDto . |
static PublicAccount |
toPublicAccount(io.nem.symbol.catapult.builders.KeyDto keyDto,
NetworkType networkType)
It creates a PublicAccount from a
KeyDto . |
static PublicKey |
toPublicKey(io.nem.symbol.catapult.builders.KeyDto dto)
It creates a catbuffer
PublicKey from a KeyDto . |
static io.nem.symbol.catapult.builders.SignatureDto |
toSignatureDto(java.lang.String signature)
It serializes the string signature into a SignatureDto catbuffer understands
|
static java.lang.String |
toString(java.nio.ByteBuffer buffer)
It extracts an UTF-8 string from the
ByteBuffer |
static UnresolvedAddress |
toUnresolvedAddress(io.nem.symbol.catapult.builders.UnresolvedAddressDto dto)
It creates a
UnresolvedAddress from an UnresolvedAddressDto . |
static io.nem.symbol.catapult.builders.UnresolvedAddressDto |
toUnresolvedAddress(UnresolvedAddress unresolvedAddress,
NetworkType networkType)
It creates a
UnresolvedAddressDto from an UnresolvedAddress . |
static UnresolvedMosaicId |
toUnresolvedMosaicId(io.nem.symbol.catapult.builders.UnresolvedMosaicIdDto dto)
It creates a
UnresolvedMosaicId from an UnresolvedMosaicIdDto . |
static io.nem.symbol.catapult.builders.UnresolvedMosaicIdDto |
toUnresolvedMosaicIdDto(UnresolvedMosaicId mosaicId)
Converts an a model
UnresolvedMosaicId into an UnresolvedMosaicIdDto from
catbuffer. |
static java.math.BigInteger |
toUnsignedBigInteger(io.nem.symbol.catapult.builders.AmountDto amountDto)
It converts an AmountDto into a positive
BigInteger . |
static java.math.BigInteger |
toUnsignedBigInteger(long value)
It converts a signed long to a positive integer.
|
static long |
toUnsignedLong(java.math.BigInteger number)
Converts and valida a big integer value to "unsigned long".
|
static VotingKey |
toVotingKey(io.nem.symbol.catapult.builders.VotingKeyDto votingKeyDto)
It creates a
VotingKey from the DTO |
static io.nem.symbol.catapult.builders.VotingKeyDto |
toVotingKeyDto(java.lang.String key)
It creates a catbuffer VotingKeyDto from a
VotingKey . |
static io.nem.symbol.catapult.builders.VotingKeyDto |
toVotingKeyDto(VotingKey key)
It creates a catbuffer VotingKeyDto from a
VotingKey . |
public static PublicAccount toPublicAccount(io.nem.symbol.catapult.builders.KeyDto keyDto, NetworkType networkType)
KeyDto
.keyDto
- catbuffer KeyDto
.networkType
- the network typePublicAccount
public static Mosaic toMosaic(io.nem.symbol.catapult.builders.UnresolvedMosaicBuilder builder)
UnresolvedMosaicBuilder
.builder
- the catbuffer UnresolvedMosaicBuilder
.Mosaic
public static UnresolvedMosaicId toUnresolvedMosaicId(io.nem.symbol.catapult.builders.UnresolvedMosaicIdDto dto)
UnresolvedMosaicId
from an UnresolvedMosaicIdDto
.dto
- the catbuffer UnresolvedMosaicIdDto
.UnresolvedMosaicId
public static MosaicId toMosaicId(io.nem.symbol.catapult.builders.MosaicIdDto dto)
MosaicId
from an MosaicIdDto
.dto
- the catbuffer MosaicIdDto
.MosaicId
public static NamespaceId toNamespaceId(io.nem.symbol.catapult.builders.NamespaceIdDto dto)
NamespaceId
from an NamespaceIdDto
.dto
- the catbuffer NamespaceIdDto
.NamespaceId
public static java.nio.ByteBuffer fromUnresolvedAddressToByteBuffer(UnresolvedAddress unresolvedAddress, NetworkType networkType)
UnresolvedAddress
to an hex catbuffer understand.unresolvedAddress
- the Address
or NamespaceId
to be serialized.networkType
- the network type to customize the NamespaceId
serializationUnresolvedAddress
as ByteBuffer
.public static java.nio.ByteBuffer fromAddressToByteBuffer(Address resolvedAddress)
Address
into a ByteBuffer
resolvedAddress
- the resolved addressByteBuffer
public static io.nem.symbol.catapult.builders.AddressDto toAddressDto(Address resolvedAddress)
Address
into a ByteBuffer
resolvedAddress
- the resolved addressByteBuffer
public static Address toAddress(io.nem.symbol.catapult.builders.AddressDto dto)
Address
from an AddressDto
.dto
- the catbuffer AddressDto
.Address
public static io.nem.symbol.catapult.builders.UnresolvedAddressDto toUnresolvedAddress(UnresolvedAddress unresolvedAddress, NetworkType networkType)
UnresolvedAddressDto
from an UnresolvedAddress
.unresolvedAddress
- the catbuffer UnresolvedAddressDto
.networkType
- the network type serialized in the payload.UnresolvedAddressDto
public static UnresolvedAddress toUnresolvedAddress(io.nem.symbol.catapult.builders.UnresolvedAddressDto dto)
UnresolvedAddress
from an UnresolvedAddressDto
.dto
- the catbuffer UnresolvedAddressDto
.UnresolvedAddress
public static int byteToUnsignedInt(byte value)
value
- the byte, it can be a overflowed negative byte.public static int shortToUnsignedInt(short value)
value
- the short, it can be a overflowed negative short.public static long intToUnsignedLong(int value)
value
- the int, it can be a overflowed negative int.public static java.io.DataInputStream toDataInput(byte[] payload)
DataInputStream
from a binary payload.payload
- the payloadDataInputStream
catbuffer uses.public static java.math.BigInteger toUnsignedBigInteger(io.nem.symbol.catapult.builders.AmountDto amountDto)
BigInteger
.amountDto
- the catbuffer AmountDto
BigInteger
.public static java.math.BigInteger toUnsignedBigInteger(long value)
value
- the short, it can be a overflowed negative long.public static java.lang.String toHexString(io.nem.symbol.catapult.builders.Hash256Dto dto)
Hash256Dto
dto
- the Hash256Dto
public static long toUnsignedLong(java.math.BigInteger number)
number
- The input string.public static java.lang.String toHexString(java.nio.ByteBuffer buffer)
ByteBuffer
buffer
- the ByteBuffer
public static java.lang.String toString(java.nio.ByteBuffer buffer)
ByteBuffer
buffer
- the ByteBuffer
public static byte[] concat(byte[] commonBytes, byte[] transactionBytes)
commonBytes
- the common transaction byte arraytransactionBytes
- the specific transaction byte array.public static java.nio.ByteBuffer toByteBuffer(PublicAccount publicAccount)
publicAccount
- to be serialized.public static io.nem.symbol.catapult.builders.SignatureDto toSignatureDto(java.lang.String signature)
signature
- the signature stringpublic static io.nem.symbol.catapult.builders.KeyDto toKeyDto(PublicKey publicKey)
PublicKey
.publicKey
- the public key.public static PublicKey toPublicKey(io.nem.symbol.catapult.builders.KeyDto dto)
PublicKey
from a KeyDto
.dto
- the public key.PublicKey
public static VotingKey toVotingKey(io.nem.symbol.catapult.builders.VotingKeyDto votingKeyDto)
VotingKey
from the DTOvotingKeyDto
- the dtoVotingKey
public static io.nem.symbol.catapult.builders.VotingKeyDto toVotingKeyDto(VotingKey key)
VotingKey
.key
- the voting key.public static io.nem.symbol.catapult.builders.VotingKeyDto toVotingKeyDto(java.lang.String key)
VotingKey
.key
- the voting key.public static io.nem.symbol.catapult.builders.Hash256Dto toHash256Dto(java.lang.String hash)
hash
- the hashHash256Dto
public static io.nem.symbol.catapult.builders.UnresolvedMosaicIdDto toUnresolvedMosaicIdDto(UnresolvedMosaicId mosaicId)
UnresolvedMosaicId
into an UnresolvedMosaicIdDto
from
catbuffer.mosaicId
- the modelpublic static io.nem.symbol.catapult.builders.MosaicIdDto toMosaicIdDto(MosaicId mosaicId)
MosaicId
into an MosaicIdDto
from catbuffer.mosaicId
- the modelpublic static io.nem.symbol.catapult.builders.FinalizationEpochDto toFinalizationEpochDto(long finalizationEpoch)
finalizationEpoch
- the unit 32 long finalization epochpublic static java.util.List<io.nem.symbol.catapult.builders.MosaicBuilder> toMosaicBuilders(java.util.List<ResolvedMosaic> mosaics)
mosaics
- the mosaicspublic static io.nem.symbol.catapult.builders.AmountDto toAmount(java.math.BigInteger amount)
AmountDto
amount
- the big int amountpublic static java.util.EnumSet<io.nem.symbol.catapult.builders.MosaicFlagsDto> getMosaicFlagsEnumSet(MosaicFlags flags)