test_class.declarator: logger = LoggerFactory.getLogger(GSMCharsetTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger logger = LoggerFactory.getLogger(GSMCharsetTest.class);
test_class.type: Logger
test_class.var_name: logger
test_class.file: ch-commons-charset/src/test/java/com/cloudhopper/commons/charset/GSMCharsetTest.java
test_class.identifier: GSMCharsetTest
test_case.body: @Test
      public void canRepresent() throws Exception {
          // nulls are always ok
          Assert.assertEquals(true, GSMCharset.canRepresent(null));
          Assert.assertEquals(true, GSMCharset.canRepresent(" "));
          Assert.assertEquals(true, GSMCharset.canRepresent("\n\r"));
          Assert.assertEquals(true, GSMCharset.canRepresent("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"));
          Assert.assertEquals(true, GSMCharset.canRepresent("Hello @ World"));
          Assert.assertEquals(true, GSMCharset.canRepresent("{}[]$"));
          // euro currency symbol is good
          Assert.assertEquals(true, GSMCharset.canRepresent("\u20ac"));
          // arabic char is not valid GSM char
          Assert.assertEquals(false, GSMCharset.canRepresent("\u0623"));
          // bug found with A-z if statement in previous charset
          // 1 char in-between the upper-case and lower-case snuck in the
          // simple range check -- the '`' char is NOT in the GSM charset
          Assert.assertEquals(false, GSMCharset.canRepresent("`"));
          Assert.assertEquals(true, GSMCharset.canRepresent("[\\]^_"));
          // form feed: uncommon but technically part of the spec
          Assert.assertEquals(true, GSMCharset.canRepresent("\f"));
          
          // create a fully correct string from lookup tables
          // strings to decode/encode to/from UTF-8
          // build a string of every GSM char
          StringBuilder s = new StringBuilder();
          for (int i = 0; i < GSMCharset.CHAR_TABLE.length; i++) {
              char c = GSMCharset.CHAR_TABLE[i];
              if (c > 0) {
                  s.append(c);
              }
          }
          for (int i = 0; i < GSMCharset.EXT_CHAR_TABLE.length; i++) {
              char c = GSMCharset.EXT_CHAR_TABLE[i];
              if (c > 0) {
                  s.append(c);
              }
          }
          
          Assert.assertEquals(true, GSMCharset.canRepresent(s.toString()));
      }
test_case.class_method_signature: GSMCharsetTest.canRepresent()
test_case.full_signature: @Test public void canRepresent()
test_case.identifier: canRepresent
test_case.invocations: assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent assertEquals canRepresent append append assertEquals canRepresent toString
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void canRepresent()
focal_class.declarator: EXTENDED_ESCAPE = 0x1b
focal_class.modifier: public static final
focal_class.original_string: public static final int EXTENDED_ESCAPE = 0x1b;
focal_class.type: int
focal_class.var_name: EXTENDED_ESCAPE
focal_class.declarator: PAGE_BREAK = 0x0a
focal_class.modifier: public static final
focal_class.original_string: public static final int PAGE_BREAK = 0x0a;
focal_class.type: int
focal_class.var_name: PAGE_BREAK
focal_class.declarator: CHAR_TABLE = {
          '@', '\u00a3', '$', '\u00a5', '\u00e8', '\u00e9', '\u00f9', '\u00ec',
          '\u00f2', '\u00c7', '\n', '\u00d8', '\u00f8', '\r', '\u00c5', '\u00e5',
          '\u0394', '_', '\u03a6', '\u0393', '\u039b', '\u03a9', '\u03a0', '\u03a8',
          '\u03a3', '\u0398', '\u039e', ' ', '\u00c6', '\u00e6', '\u00df', '\u00c9',  // 0x1B is actually an escape which we'll encode to a space char
          ' ', '!', '"', '#', '\u00a4', '%', '&', '\'',
          '(', ')', '*', '+', ',', '-', '.', '/',
          '0', '1', '2', '3', '4', '5', '6', '7',
          '8', '9', ':', ';', '<', '=', '>', '?',
          '\u00a1', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
          'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
          'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
          'X', 'Y', 'Z', '\u00c4', '\u00d6', '\u00d1', '\u00dc', '\u00a7',
          '\u00bf', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
          'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
          'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
          'x', 'y', 'z', '\u00e4', '\u00f6', '\u00f1', '\u00fc', '\u00e0',
      }
focal_class.modifier: public static final
focal_class.original_string: public static final char[] CHAR_TABLE = {
          '@', '\u00a3', '$', '\u00a5', '\u00e8', '\u00e9', '\u00f9', '\u00ec',
          '\u00f2', '\u00c7', '\n', '\u00d8', '\u00f8', '\r', '\u00c5', '\u00e5',
          '\u0394', '_', '\u03a6', '\u0393', '\u039b', '\u03a9', '\u03a0', '\u03a8',
          '\u03a3', '\u0398', '\u039e', ' ', '\u00c6', '\u00e6', '\u00df', '\u00c9',  // 0x1B is actually an escape which we'll encode to a space char
          ' ', '!', '"', '#', '\u00a4', '%', '&', '\'',
          '(', ')', '*', '+', ',', '-', '.', '/',
          '0', '1', '2', '3', '4', '5', '6', '7',
          '8', '9', ':', ';', '<', '=', '>', '?',
          '\u00a1', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
          'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
          'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
          'X', 'Y', 'Z', '\u00c4', '\u00d6', '\u00d1', '\u00dc', '\u00a7',
          '\u00bf', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
          'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
          'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
          'x', 'y', 'z', '\u00e4', '\u00f6', '\u00f1', '\u00fc', '\u00e0',
      };
focal_class.type: char[]
focal_class.var_name: CHAR_TABLE
focal_class.declarator: EXT_CHAR_TABLE = {
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, '\f', 0, 0, 0, 0, 0,
              0, 0, 0, 0, '^', 0, 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
              '{', '}', 0, 0, 0, 0, 0, '\\',
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, '[', '~', ']', 0,
              '|', 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, '\u20ac', 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
      }
focal_class.modifier: public static final
focal_class.original_string: public static final char[] EXT_CHAR_TABLE = {
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, '\f', 0, 0, 0, 0, 0,
              0, 0, 0, 0, '^', 0, 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
              '{', '}', 0, 0, 0, 0, 0, '\\',
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, '[', '~', ']', 0,
              '|', 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, '\u20ac', 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0,
      };
focal_class.type: char[]
focal_class.var_name: EXT_CHAR_TABLE
focal_class.file: ch-commons-charset/src/main/java/com/cloudhopper/commons/charset/GSMCharset.java
focal_class.identifier: GSMCharset
focal_class.class_method_signature: GSMCharset.canRepresent(CharSequence str0)
focal_class.full_signature: static public boolean canRepresent(CharSequence str0)
focal_class.identifier: canRepresent
focal_class.modifiers: static public
focal_class.parameters: (CharSequence str0)
focal_class.return: boolean
focal_class.signature: boolean canRepresent(CharSequence str0)
focal_class.class_method_signature: GSMCharset.estimateEncodeByteLength(CharSequence str0)
focal_class.full_signature: @Override public int estimateEncodeByteLength(CharSequence str0)
focal_class.identifier: estimateEncodeByteLength
focal_class.modifiers: @Override public
focal_class.parameters: (CharSequence str0)
focal_class.return: int
focal_class.signature: int estimateEncodeByteLength(CharSequence str0)
focal_class.class_method_signature: GSMCharset.encode(CharSequence str0)
focal_class.full_signature: @Override public byte[] encode(CharSequence str0)
focal_class.identifier: encode
focal_class.modifiers: @Override public
focal_class.parameters: (CharSequence str0)
focal_class.return: byte[]
focal_class.signature: byte[] encode(CharSequence str0)
focal_class.class_method_signature: GSMCharset.estimateDecodeCharLength(byte[] bytes)
focal_class.full_signature: @Override public int estimateDecodeCharLength(byte[] bytes)
focal_class.identifier: estimateDecodeCharLength
focal_class.modifiers: @Override public
focal_class.parameters: (byte[] bytes)
focal_class.return: int
focal_class.signature: int estimateDecodeCharLength(byte[] bytes)
focal_class.class_method_signature: GSMCharset.decode(byte[] bytes, StringBuilder buffer)
focal_class.full_signature: @Override public void decode(byte[] bytes, StringBuilder buffer)
focal_class.identifier: decode
focal_class.modifiers: @Override public
focal_class.parameters: (byte[] bytes, StringBuilder buffer)
focal_class.return: void
focal_class.signature: void decode(byte[] bytes, StringBuilder buffer)
focal_class.superclass: extends BaseCharset
focal_method.body: static public boolean canRepresent(CharSequence str0) {
          if (str0 == null) {
              return true;
          }
  
          int len = str0.length();
          for (int i = 0; i < len; i++) {
              // get the char in this string
              char c = str0.charAt(i);
              // simple range checks for most common characters (0x20 -> 0x5F) or (0x61 -> 0x7E)
              if ((c >= ' ' && c <= '_') || (c >= 'a' && c <= '~')) {
                  continue;
              } else {
                  // 10X more efficient using a switch statement vs. a lookup table search
                  switch (c) {
                      case '\u00A3':	// £
                      case '\u00A5':	// ¥
                      case '\u00E8':	// è
                      case '\u00E9':	// é
                      case '\u00F9':	// ù
                      case '\u00EC':	// ì
                      case '\u00F2':	// ò
                      case '\u00C7':	// Ç
                      case '\n':          // newline
                      case '\u00D8':	// Ø
                      case '\u00F8':	// ø
                      case '\r':          // carriage return
                      case '\u000c':      // form feed
                      case '\u00C5':	// Å
                      case '\u00E5':	// å
                      case '\u0394':	// Δ
                      case '\u03A6':	// Φ
                      case '\u0393':	// Γ
                      case '\u039B':	// Λ
                      case '\u03A9':	// Ω
                      case '\u03A0':	// Π
                      case '\u03A8':	// Ψ
                      case '\u03A3':	// Σ
                      case '\u0398':	// Θ
                      case '\u039E':	// Ξ
                      case '\u00C6':	// Æ
                      case '\u00E6':	// æ
                      case '\u00DF':	// ß
                      case '\u00C9':	// É
                      case '\u00A4':	// ¤
                      case '\u00A1':	// ¡
                      case '\u00C4':	// Ä
                      case '\u00D6':	// Ö
                      case '\u00D1':	// Ñ
                      case '\u00DC':	// Ü
                      case '\u00A7':	// §
                      case '\u00BF':	// ¿
                      case '\u00E4':	// ä
                      case '\u00F6':	// ö
                      case '\u00F1':	// ñ
                      case '\u00FC':	// ü
                      case '\u00E0':	// à
                      case '\u20AC':	// €
                          continue;
                      default:
                          return false;
                  }
              }
          }
          return true;
      }
focal_method.class_method_signature: GSMCharset.canRepresent(CharSequence str0)
focal_method.full_signature: static public boolean canRepresent(CharSequence str0)
focal_method.identifier: canRepresent
focal_method.invocations: length charAt
focal_method.modifiers: static public
focal_method.parameters: (CharSequence str0)
focal_method.return: boolean
focal_method.signature: boolean canRepresent(CharSequence str0)