Class ByteArraySwap.SpacedHex

Enclosing class:
ByteArraySwap

public static class ByteArraySwap.SpacedHex extends ByteArraySwap
Converts byte arrays to spaced-hex encoding.
  • Constructor Details

  • Method Details

    • swap

      public String swap(BeanSession session, byte[] b) throws Exception
      Converts the specified byte[] to a String.
      Overrides:
      swap in class StringSwap<byte[]>
      Parameters:
      session - The bean session to use to get the class meta. This is always going to be the same bean context that created this swap.
      b - The object to be transformed.
      Returns:
      The transformed object.
      Throws:
      Exception - If a problem occurred trying to convert the output.
    • unswap

      public byte[] unswap(BeanSession session, String s, ClassMeta<?> hint) throws Exception
      Converts the specified String to a byte[].
      Overrides:
      unswap in class StringSwap<byte[]>
      Parameters:
      session - The bean session to use to get the class meta. This is always going to be the same bean context that created this swap.
      s - The transformed object.
      hint - If possible, the parser will try to tell you the object type being created. For example, on a serialized date, this may tell you that the object being created must be of type GregorianCalendar.
      This may be null if the parser cannot make this determination.
      Returns:
      The narrowed object.
      Throws:
      Exception - If this method is not implemented.