Package nxt.util
Class Convert
java.lang.Object
nxt.util.Convert
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<byte[]>static final byte[]static final byte[][]static final long[]static final BigInteger -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbigIntegerToHexString(BigInteger bigInteger, int expectedLength) static longbytesToLong(byte[] b) static byte[]compress(byte[] bytes) static longdecimalMultiplier(int decimals) static byte[]emptyToNull(byte[] bytes) static Stringstatic longfromEpochTime(int epochTime) static longfullHashToId(byte[] hash) static intgetMaxStringSize(int length) static byte[]intToLittleEndian(int pathComponent) static booleanisUtf8Text(byte[] message) static byte[]longToBytes(long l) static longlongValueExact(BigInteger bigInteger) static byte[][]nullToEmpty(byte[][] bytes) static long[]nullToEmpty(long[] array) static Stringstatic longnullToZero(Long l) static longparseAccountId(String account) static byte[]parseHexString(String hex) static intstatic longstatic longparseUnsignedLong(String number) static byte[]pkcs7Pad(byte[] plaintext) static byte[]pkcs7Unpad(byte[] padded) static StringreadString(ByteBuffer buffer, int numBytes, int maxLength) static StringrsAccount(long accountId) static longstatic StringrsEncode(long id) static byte[]switchEndian(byte[] b) Converts an array in place from big to little endian and vice versastatic Long[]toArray(long[] array) static long[]static long[]static BigDecimaltoBigDecimal(long amount, byte decimals) static byte[]toBytes(long n) static byte[]static byte[]static inttoEpochTime(long currentTime) static StringtoHexString(byte[] bytes) toList(long[] array) toSet(long[] array) static byte[]toSignedBytes(short[] s) static StringtoString(byte[] bytes) static StringtoString(byte[] bytes, boolean isText) static short[]toUnsignedBytes(byte[] b) static Stringstatic byte[]uncompress(byte[] bytes) static longunitRateToAmount(long unitsQNT, int unitsDecimals, long rateNQT, int rateDecimals)
-
Field Details
-
two64
-
EMPTY_LONG
public static final long[] EMPTY_LONG -
EMPTY_BYTE
public static final byte[] EMPTY_BYTE -
EMPTY_BYTES
public static final byte[][] EMPTY_BYTES -
byteArrayComparator
-
-
Method Details
-
parseHexString
-
toHexString
-
parseUnsignedLong
-
parseInt
-
parseLong
-
parseAccountId
-
rsAccount
-
rsEncode
-
rsDecode
-
fullHashToId
public static long fullHashToId(byte[] hash) -
fromEpochTime
public static long fromEpochTime(int epochTime) -
toEpochTime
public static int toEpochTime(long currentTime) -
emptyToNull
-
nullToEmpty
-
emptyToNull
public static byte[] emptyToNull(byte[] bytes) -
nullToEmpty
public static byte[][] nullToEmpty(byte[][] bytes) -
nullToEmpty
public static long[] nullToEmpty(long[] array) -
nullToZero
-
toArray
-
toList
-
toArray
-
toArray
-
toSet
-
toBytes
-
toBytes
-
toString
-
toString
-
toBytes
public static byte[] toBytes(long n) -
readString
public static String readString(ByteBuffer buffer, int numBytes, int maxLength) throws NxtException.NotValidException - Throws:
NxtException.NotValidException
-
getMaxStringSize
public static int getMaxStringSize(int length) -
truncate
-
decimalMultiplier
public static long decimalMultiplier(int decimals) -
compress
public static byte[] compress(byte[] bytes) -
uncompress
public static byte[] uncompress(byte[] bytes) -
unitRateToAmount
public static long unitRateToAmount(long unitsQNT, int unitsDecimals, long rateNQT, int rateDecimals) -
longToBytes
public static byte[] longToBytes(long l) -
bytesToLong
public static long bytesToLong(byte[] b) -
longValueExact
-
pkcs7Pad
public static byte[] pkcs7Pad(byte[] plaintext) -
pkcs7Unpad
public static byte[] pkcs7Unpad(byte[] padded) -
toSignedBytes
public static byte[] toSignedBytes(short[] s) -
toUnsignedBytes
public static short[] toUnsignedBytes(byte[] b) -
intToLittleEndian
public static byte[] intToLittleEndian(int pathComponent) -
switchEndian
public static byte[] switchEndian(byte[] b) Converts an array in place from big to little endian and vice versa- Parameters:
b- input/output array modified in place, use Arrays.copy() when calling to avoid modification- Returns:
- the converted array
-
isUtf8Text
public static boolean isUtf8Text(byte[] message) -
bigIntegerToHexString
-
toBigDecimal
-