java.lang.Object
com.blackhillsoftware.smf.Data
com.blackhillsoftware.smf.Token

public class Token extends Data
Base class for comparable token data. This class is intended to be extended to create Tokens of different types which may have additional properties. Tokens of the same type can be compared for equality, used as HashMap keys etc. Tokens of different types can be compared by getting the basicToken() and using that for the comparison.
  • Constructor Details

    • Token

      public Token(byte[] source, int offset, int length)
      Create a Token with data copied from an existing byte array
      Parameters:
      source - the byte array containing the token
      offset - the offset of the start of the token
      length - the length of the token
    • Token

      public Token(byte[] source)
      Create a Token from a byte array.
      Parameters:
      source - a byte array containing a complete Token
  • Method Details

    • basicToken

      public Token basicToken()
      Return a basic Token object, which can be compared to other basic Tokens. This allows you to compare tokens of different Java types, e.g. if tokens are intended to track the same work across different record types but have been implemented as different types.
      Returns:
      a Token
    • asHex

      public String asHex()
      Return the hexadecimal value of the token
      Returns:
      a hexadecimal formatted string
    • asString

      public String asString()
      Return the token converted from EBCDIC to a String value. This may or may not be a useful value depending on the token.
      Returns:
      String the token converted to a String
    • toString

      public String toString()
      Overrides:
      toString in class Data