pig/src/main/java/com/twitter/elephantbird/pig/util/PigTokenHelper.java
public static byte evaluateDelimiter(String inputDelimiter) {
    if (inputDelimiter.length() == 1) {
      return inputDelimiter.getBytes()[0];
    } else if (inputDelimiter.length() > 1 && inputDelimiter.charAt(0) == '\\') {
      switch (inputDelimiter.charAt(1)) {
      case 't':
        return (byte)'\t';

      case 'x':
      case 'u':
        return Integer.valueOf(inputDelimiter.substring(2)).byteValue();

      default:
        throw new IllegalArgumentException("Unknown delimiter " + inputDelimiter);
      }
    } else {
      throw new IllegalArgumentException("LzoTokenizedStorage delimeter must be a single character");
    }
  }
public static byte evaluateDelimiter(String inputDelimiter) {
    if (inputDelimiter.length() == 1) {
      return inputDelimiter.getBytes()[0];
    } else if (inputDelimiter.length() > 1 && inputDelimiter.charAt(0) == '\\') {
      switch (inputDelimiter.charAt(1)) {
      case 't':
        return (byte)'\t';

      case 'x':
      case 'u':
        return Integer.valueOf(inputDelimiter.substring(2)).byteValue();

      default:
        throw new IllegalArgumentException("Unknown delimiter " + inputDelimiter);
      }
    } else {
      throw new IllegalArgumentException("LzoTokenizedStorage delimeter must be a single character");
    }
  }
public static byte evaluateDelimiter ( String inputDelimiter ) { if ( inputDelimiter . length ( ) == 1 ) { return inputDelimiter . getBytes ( ) [ 0 ] ; } else if ( inputDelimiter . length ( ) > 1 && inputDelimiter . charAt ( 0 ) == ' ' ) { switch ( inputDelimiter . charAt ( 1 ) ) { case ' ' : return ( byte ) ' ' ; case ' ' : case ' ' : return Integer . valueOf ( inputDelimiter . substring ( 2 ) ) . byteValue ( ) ; default : throw new IllegalArgumentException ( "Unknown delimiter " + inputDelimiter ) ; } } else { throw new IllegalArgumentException ( "LzoTokenizedStorage delimeter must be a single character" ) ; } }
Parse an input delimiter string, as with PigStorage, and return the byte it represents.
@param inputDelimiter the string passed in from the pig script.
@return the corresponding byte that will serve as the field separator.
Parse an input delimiter string as with PigStorage and return the byte it represents .