Class Base02Utils

java.lang.Object
craterdog.utils.Base02Utils

public final class Base02Utils extends Object
This utility class provides functions for encoding and decoding byte arrays using base 2. The character set used for the encoding includes the following characters: 0..1
Author:
Derk Norton
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    decode(String base2)
    This function decodes a base 2 string into its corresponding byte array.
    static String
    encode(byte[] bytes)
    This function encodes a byte array using base 2 with no indentation of new lines.
    static String
    encode(byte[] bytes, String indentation)
    This function encodes a byte array using base 2 with a specific indentation of new lines.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • encode

      public static String encode(byte[] bytes)
      This function encodes a byte array using base 2 with no indentation of new lines.
      Parameters:
      bytes - The byte array to be encoded.
      Returns:
      The base 2 encoded string.
    • encode

      public static String encode(byte[] bytes, String indentation)
      This function encodes a byte array using base 2 with a specific indentation of new lines.
      Parameters:
      bytes - The byte array to be encoded.
      indentation - The indentation string to be inserted before each new line.
      Returns:
      The base 2 encoded string.
    • decode

      public static byte[] decode(String base2)
      This function decodes a base 2 string into its corresponding byte array.
      Parameters:
      base2 - The base 2 encoded string.
      Returns:
      The corresponding byte array.