-
public interface Base
-
-
Method Summary
Modifier and Type Method Description abstract booleansuccessful(int res)abstract <T> Tres(int res, T object)abstract Stringstr(Array<byte> bs)Converts a byte array to a stringusing a charset. abstract Stringstr(Array<byte> bs, Charset charset)Convert a byte array to a string with a charset.This may not be what you want to use if you're storing this stringin a database for example. abstract Array<byte>bytes(String s)Convert a string to bytes using the configured charset. abstract booleanwrongLen(Array<byte> bs, int shouldBeLen)abstract booleanwrongLen(int byteLength, int shouldBeLen)abstract booleanwrongLen(int byteLength, long shouldBeLen)abstract Array<byte>removeNulls(Array<byte> bs)Remove all the null bytes from theend of a byte array. -
-
Method Detail
-
successful
abstract boolean successful(int res)
-
res
abstract <T> T res(int res, T object)
-
str
abstract String str(Array<byte> bs)
Converts a byte array to a stringusing a charset. This may not be what you want to use if you're storing this stringin a database for example. This function will produce null bytes and unexpectedcarriage returns. Please use sodiumBin2Hex to convert your byte array to a hexadecimal string that ensures no nulls or carriage breaks.
- Parameters:
bs- The byte array.
-
str
abstract String str(Array<byte> bs, Charset charset)
Convert a byte array to a string with a charset.This may not be what you want to use if you're storing this stringin a database for example. This function will produce null bytes and unexpectedcarriage returns. Please use sodiumBin2Hex to convert your byte array to a hexadecimal string that ensures no nulls or carriage breaks.
- Parameters:
bs- Byte array.charset- The charset.
-
bytes
abstract Array<byte> bytes(String s)
Convert a string to bytes using the configured charset.
- Parameters:
s- The String to convert to a byte array.
-
wrongLen
abstract boolean wrongLen(int byteLength, int shouldBeLen)
-
wrongLen
abstract boolean wrongLen(int byteLength, long shouldBeLen)
-
removeNulls
abstract Array<byte> removeNulls(Array<byte> bs)
Remove all the null bytes from theend of a byte array.
- Parameters:
bs- A byte array.
-
-
-
-