java.lang.Object
io.nosqlbench.virtdata.library.basics.shared.util.CharsetMapping

public class CharsetMapping
extends java.lang.Object
  • Constructor Summary

    Constructors
    Constructor Description
    CharsetMapping()  
  • Method Summary

    Modifier and Type Method Description
    static char[][] parseSpec​(java.lang.String spec)
    Parse the spec, yielding an array of character arrays.
    static char[] rangeFor​(java.lang.String range)
    Parse the range and return set of characters in an array.
    static java.util.List<java.lang.Character> rangeFor​(java.lang.String startChar, java.lang.String endChar)
    Create a list of characters from the US ASCII plane based on a start and end character.

    Methods inherited from class java.lang.Object

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

    • CharsetMapping

      public CharsetMapping()
  • Method Details

    • parseSpec

      public static char[][] parseSpec​(java.lang.String spec)
      Parse the spec, yielding an array of character arrays. each position in the spec delimited by comma or semicolon is represented by an array. Each array is then constructed from rangeFor(String).
      Parameters:
      spec - A range set specifier
      Returns:
      An array of char arrays
    • rangeFor

      public static char[] rangeFor​(java.lang.String range)
      Parse the range and return set of characters in an array. Any occurrences of a range specifier like a-z are expanded into the two characters and every on in between, in ordinal order. Otherwise, the characters are taken as they are presented. Each range is built and sanity checked by rangeFor(java.lang.String) to ensure ordering is valid as well as that the characters are all in the printable range of ordinal 32 to ordinal 126.
      Parameters:
      range - a character range specifier like 'a-z' or '1357'
      Returns:
      An array of characters
    • rangeFor

      public static java.util.List<java.lang.Character> rangeFor​(java.lang.String startChar, java.lang.String endChar)
      Create a list of characters from the US ASCII plane based on a start and end character.
      Parameters:
      startChar - A single ASCII character
      endChar - A single ASCII character, must be equal to or come after startChar
      Returns:
      A list of characters in the range