public static XContentType xContentType(CharSequence content){
  int length=content.length() < GUESS_HEADER_LENGTH ? content.length() : GUESS_HEADER_LENGTH;
  if (length == 0) {
    return null;
  }
  char first=content.charAt(0);
  if (first == '{') {
    return XContentType.JSON;
  }
  if (length > 2 && first == SmileConstants.HEADER_BYTE_1 && content.charAt(1) == SmileConstants.HEADER_BYTE_2 && content.charAt(2) == SmileConstants.HEADER_BYTE_3) {
    return XContentType.SMILE;
  }
  if (length > 2 && first == '-' && content.charAt(1) == '-' && content.charAt(2) == '-') {
    return XContentType.YAML;
  }
  for (int i=0; i < length; i++) {
    char c=content.charAt(i);
    if (c == '{') {
      return XContentType.JSON;
    }
    if (Character.isWhitespace(c) == false) {
      break;
    }
  }
  return null;
}

public static XContentType xContentType ( CharSequence content ) { int length = content . length ( ) < GUESS_HEADER_LENGTH ? content . length ( ) : GUESS_HEADER_LENGTH ; if ( length == 0 ) { return null ; } char first = content . charAt ( 0 ) ; if ( first == '{' ) { return XContentType . JSON ; } if ( length > 2 && first == SmileConstants . HEADER_BYTE_1 && content . charAt ( 1 ) == SmileConstants . HEADER_BYTE_2 && content . charAt ( 2 ) == SmileConstants . HEADER_BYTE_3 ) { return XContentType . SMILE ; } if ( length > 2 && first == '-' && content . charAt ( 1 ) == '-' && content . charAt ( 2 ) == '-' ) { return XContentType . YAML ; } for ( int i = 0 ; i < length ; i ++ ) { char c = content . charAt ( i ) ; if ( c == '{' ) { return XContentType . JSON ; } if ( Character . isWhitespace ( c ) == false ) { break ; } } return null ; }
guesses the content type based on the provided char sequence .
