Package 

Interface Base


  • 
    public interface Base
    
                        
    • Method Summary

      Modifier and Type Method Description
      abstract boolean successful(int res)
      abstract <T> T res(int res, T object)
      abstract String str(Array<byte> bs) Converts a byte array to a stringusing a charset.
      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.
      abstract Array<byte> bytes(String s) Convert a string to bytes using the configured charset.
      abstract boolean wrongLen(Array<byte> bs, int shouldBeLen)
      abstract boolean wrongLen(int byteLength, int shouldBeLen)
      abstract boolean wrongLen(int byteLength, long shouldBeLen)
      abstract Array<byte> removeNulls(Array<byte> bs) Remove all the null bytes from theend of a byte array.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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(Array<byte> bs, int shouldBeLen)
      • 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.