Similar to the Quoted-Printable content-transfer-encoding defined in RFC 1521 and designed to allow text containing mostly ASCII characters to be decipherable on an ASCII terminal without decoding. RF
| 49 | * @since 1.3 |
| 50 | */ |
| 51 | public class QCodec extends RFC1522Codec implements StringEncoder, StringDecoder { |
| 52 | /** |
| 53 | * The default Charset used for string decoding and encoding. |
| 54 | */ |
| 55 | private final Charset charset; |
| 56 | |
| 57 | /** |
| 58 | * BitSet of printable characters as defined in RFC 1522. |
| 59 | */ |
| 60 | private static final BitSet PRINTABLE_CHARS = new BitSet(256); |
| 61 | // Static initializer for printable chars collection |
| 62 | static { |
| 63 | // alpha characters |
| 64 | PRINTABLE_CHARS.set(' '); |
| 65 | PRINTABLE_CHARS.set('!'); |
| 66 | PRINTABLE_CHARS.set('"'); |
| 67 | PRINTABLE_CHARS.set('#'); |
| 68 | PRINTABLE_CHARS.set('$'); |
| 69 | PRINTABLE_CHARS.set('%'); |
| 70 | PRINTABLE_CHARS.set('&'); |
| 71 | PRINTABLE_CHARS.set('\''); |
| 72 | PRINTABLE_CHARS.set('('); |
| 73 | PRINTABLE_CHARS.set(')'); |
| 74 | PRINTABLE_CHARS.set('*'); |
| 75 | PRINTABLE_CHARS.set('+'); |
| 76 | PRINTABLE_CHARS.set(','); |
| 77 | PRINTABLE_CHARS.set('-'); |
| 78 | PRINTABLE_CHARS.set('.'); |
| 79 | PRINTABLE_CHARS.set('/'); |
| 80 | for (int i = '0'; i <= '9'; i++) { |
| 81 | PRINTABLE_CHARS.set(i); |
| 82 | } |
| 83 | PRINTABLE_CHARS.set(':'); |
| 84 | PRINTABLE_CHARS.set(';'); |
| 85 | PRINTABLE_CHARS.set('<'); |
| 86 | PRINTABLE_CHARS.set('>'); |
| 87 | PRINTABLE_CHARS.set('@'); |
| 88 | for (int i = 'A'; i <= 'Z'; i++) { |
| 89 | PRINTABLE_CHARS.set(i); |
| 90 | } |
| 91 | PRINTABLE_CHARS.set('['); |
| 92 | PRINTABLE_CHARS.set('\\'); |
| 93 | PRINTABLE_CHARS.set(']'); |
| 94 | PRINTABLE_CHARS.set('^'); |
| 95 | PRINTABLE_CHARS.set('`'); |
| 96 | for (int i = 'a'; i <= 'z'; i++) { |
| 97 | PRINTABLE_CHARS.set(i); |
| 98 | } |
| 99 | PRINTABLE_CHARS.set('{'); |
| 100 | PRINTABLE_CHARS.set('|'); |
| 101 | PRINTABLE_CHARS.set('}'); |
| 102 | PRINTABLE_CHARS.set('~'); |
| 103 | } |
| 104 | |
| 105 | private static final byte SPACE = 32; |
| 106 | |
| 107 | private static final byte UNDERSCORE = 95; |
| 108 |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…