/android/import-contacts

To get this branch, use:
bzr branch http://bzr.ed.am/android/import-contacts

« back to all changes in this revision

Viewing changes to src/org/waxworlds/edam/importcontacts/VCFImporter.java

  • Committer: edam
  • Date: 2011-03-13 18:58:52 UTC
  • Revision ID: edam@waxworlds.org-20110313185852-s74kvkbv8k0v0lwc
- accept parameters that are quoted (this doesn't appear to be part of the standards AFAICT, but Evolution apparently quotes parameter values)

Show diffs side-by-side

added added

removed removed

34
34
import java.nio.ByteBuffer;
35
35
import java.util.Arrays;
36
36
import java.util.HashSet;
37
 
import java.util.Iterator;
38
37
import java.util.List;
39
38
import java.util.Set;
40
39
import java.util.Vector;
41
40
import java.util.regex.Matcher;
42
41
import java.util.regex.Pattern;
43
 
import java.util.NoSuchElementException;
44
 
import java.lang.UnsupportedOperationException;
45
42
 
46
43
import android.content.SharedPreferences;
47
44
import android.provider.Contacts;
123
120
                {
124
121
                        // open file
125
122
                        BufferedReader reader = new BufferedReader(
126
 
                                new FileReader( file ) );
 
123
                                        new FileReader( file ) );
127
124
 
128
125
                        // read
129
126
                        String line;
132
129
                        {
133
130
                                if( !inVCard ) {
134
131
                                        // look for vcard beginning
135
 
                                        if( line.matches( "^BEGIN:VCARD" ) ) {
 
132
                                        if( line.matches( "^BEGIN[ \\t]*:[ \\t]*VCARD" ) ) {
136
133
                                                inVCard = true;
137
134
                                                _vCardCount++;
138
135
                                        }
139
136
                                }
140
 
                                else if( line.matches( "^END:VCARD" ) )
 
137
                                else if( line.matches( "^END[ \\t]*:[ \\t]*VCARD" ) )
141
138
                                        inVCard = false;
142
139
                        }
143
140
 
181
178
        }
182
179
 
183
180
        private void importVCardFileContent( byte[] content, String fileName )
184
 
                throws AbortImportException
 
181
                        throws AbortImportException
185
182
        {
 
183
                ByteBuffer buffers[] = getLinesFromContent( content );
 
184
 
186
185
                // go through lines
187
186
                VCard vCard = null;
188
 
                ContentLineIterator cli = new ContentLineIterator( content );
189
 
                while( cli.hasNext() )
 
187
                for( int i = 0; i < buffers.length; i++ )
190
188
                {
191
 
                        ByteBuffer buffer = cli.next();
192
 
 
193
189
                        // get a US-ASCII version of the line for processing
194
190
                        String line;
195
191
                        try {
196
 
                                line = new String( buffer.array(), buffer.position(),
197
 
                                        buffer.limit() - buffer.position(), "US-ASCII" );
 
192
                                line = new String( buffers[ i ].array(), buffers[ i ].position(),
 
193
                                        buffers[ i ].limit() - buffers[ i ].position(), "US-ASCII" );
198
194
                        }
199
195
                        catch( UnsupportedEncodingException e ) {
200
196
                                // we know US-ASCII is supported, so appease the compiler...
203
199
 
204
200
                        if( vCard == null ) {
205
201
                                // look for vcard beginning
206
 
                                if( line.matches( "^BEGIN:VCARD" ) ) {
 
202
                                if( line.matches( "^BEGIN[ \\t]*:[ \\t]*VCARD" ) ) {
207
203
                                        setProgress( ++_progress );
208
204
                                        vCard = new VCard();
209
205
                                }
210
206
                        }
211
207
                        else {
212
208
                                // look for vcard content or ending
213
 
                                if( line.matches( "^END:VCARD" ) )
 
209
                                if( line.matches( "^END[ \\t]*:[ \\t]*VCARD" ) )
214
210
                                {
215
211
                                        // store vcard and do away with it
216
212
                                        try {
220
216
                                        catch( VCard.ParseException e ) {
221
217
                                                skipContact();
222
218
                                                if( !showContinue(
223
 
                                                        getText( R.string.error_vcf_parse ).toString()
224
 
                                                        + fileName + "\n" + e.getMessage() ) )
225
 
                                                {
 
219
                                                                getText( R.string.error_vcf_parse ).toString()
 
220
                                                                + fileName + "\n" + e.getMessage() ) )
226
221
                                                        finish( ACTION_ABORT );
227
 
                                                }
228
222
                                        }
229
223
                                        catch( VCard.SkipContactException e ) {
230
224
                                                skipContact();
236
230
                                {
237
231
                                        // try giving the line to the vcard
238
232
                                        try {
239
 
                                                vCard.parseLine( buffer, line,
240
 
                                                        cli.doesNextLineLookFolded() );
 
233
                                                vCard.parseLine( buffers[ i ] );
241
234
                                        }
242
235
                                        catch( VCard.ParseException e ) {
243
236
                                                skipContact();
244
237
                                                if( !showContinue(
245
 
                                                        getText( R.string.error_vcf_parse ).toString()
246
 
                                                        + fileName + "\n" + e.getMessage() ) )
247
 
                                                {
 
238
                                                                getText( R.string.error_vcf_parse ).toString()
 
239
                                                                + fileName + "\n" + e.getMessage() ) )
248
240
                                                        finish( ACTION_ABORT );
249
 
                                                }
250
241
 
251
242
                                                // although we're continuing, we still need to abort
252
243
                                                // this vCard. Further lines will be ignored until we
264
255
                }
265
256
        }
266
257
 
267
 
        class ContentLineIterator implements Iterator< ByteBuffer >
 
258
        private ByteBuffer[] getLinesFromContent( byte[] content )
268
259
        {
269
 
                protected byte[] _content = null;
270
 
                protected int _pos = 0;
271
 
 
272
 
                public ContentLineIterator( byte[] content )
273
 
                {
274
 
                        _content = content;
275
 
                }
276
 
 
277
 
                @Override
278
 
                public boolean hasNext()
279
 
                {
280
 
                        return _pos < _content.length;
281
 
                }
282
 
 
283
 
                @Override
284
 
                public ByteBuffer next()
285
 
                {
286
 
                        int initial_pos = _pos;
287
 
 
288
 
                        // find newline
289
 
                        for( ; _pos < _content.length; _pos++ )
290
 
                                if( _content[ _pos ] == '\n' )
291
 
                                {
292
 
                                        // adjust for a \r preceding the \n
293
 
                                        int to = ( _pos > 0 && _content[ _pos - 1 ] == '\r' &&
294
 
                                                _pos > initial_pos )? _pos - 1 : _pos;
295
 
                                        _pos++;
296
 
                                        return ByteBuffer.wrap( _content, initial_pos,
297
 
                                                to - initial_pos );
298
 
                                }
299
 
 
300
 
                        // we didn't find one, but were there bytes left?
301
 
                        if( _pos != initial_pos ) {
302
 
                                int to = _pos;
303
 
                                _pos++;
304
 
                                return ByteBuffer.wrap( _content, initial_pos,
305
 
                                        to - initial_pos );
 
260
                // count lines in data
 
261
                int num_lines = 1;
 
262
                for( int a = 0; a < content.length; a++ )
 
263
                        if( content[ a ] == '\n' )
 
264
                                num_lines++;
 
265
 
 
266
                // get lines, removing \r's and \n's as we go
 
267
                ByteBuffer lines[] = new ByteBuffer[ num_lines ];
 
268
                int last = 0;
 
269
                for( int a = 0, b = 0; a < content.length; a++ )
 
270
                        if( content[ a ] == '\n' ) {
 
271
                                int to = ( a > 0 && content[ a - 1 ] == '\r' &&
 
272
                                        a - 1 >= last )? a - 1 : a;
 
273
                                lines[ b++ ] = ByteBuffer.wrap( content, last, to - last );
 
274
                                last = a + 1;
306
275
                        }
307
 
 
308
 
                        // no bytes left
309
 
                        throw new NoSuchElementException();
310
 
                }
311
 
 
312
 
                @Override
313
 
                public void remove()
314
 
                {
315
 
                        throw new UnsupportedOperationException();
316
 
                }
317
 
 
318
 
                /**
319
 
                 * Does the next line, if there is one, look like it should be folded
320
 
                 * onto the end of this one?
321
 
                 * @return
322
 
                 */
323
 
                public boolean doesNextLineLookFolded()
324
 
                {
325
 
                        return _pos > 0 && _pos < _content.length &&
326
 
                                _content[ _pos - 1 ] == '\n' && _content[ _pos ] == ' ';
327
 
                }
 
276
                lines[ lines.length - 1 ] = ByteBuffer.wrap( content, last,
 
277
                        content.length - last );
 
278
 
 
279
                return lines;
328
280
        }
329
281
 
330
282
        private class VCard extends ContactData
337
289
                private String _version = null;
338
290
                private Vector< ByteBuffer > _buffers = null;
339
291
                private int _name_level = NAMELEVEL_NONE;
340
 
                private boolean _parser_in_encoded_multiline = false;
341
 
                private boolean _parser_in_folded_multiline = false;
 
292
                private boolean _parser_in_multiline = false;
342
293
                private String _parser_current_name_and_params = null;
343
294
                private String _parser_buffered_value_so_far = "";
344
295
 
383
334
                @SuppressWarnings("serial")
384
335
                protected class SkipContactException extends Exception { }
385
336
 
386
 
                private String extractCollonPartFromLine( ByteBuffer buffer,
387
 
                        String line, boolean former )
388
 
                {
389
 
                        String ret = null;
390
 
 
391
 
                        // get a US-ASCII version of the line for processing, unless we were
392
 
                        // supplied with one
393
 
                        if( line == null ) {
394
 
                                try {
395
 
                                        line = new String( buffer.array(), buffer.position(),
396
 
                                                buffer.limit() - buffer.position(), "US-ASCII" );
397
 
                                }
398
 
                                catch( UnsupportedEncodingException e ) {
399
 
                                        // we know US-ASCII is supported, so appease the compiler...
400
 
                                        line = "";
401
 
                                }
402
 
                        }
403
 
 
404
 
                        // split line into name and value parts and check to make sure we
405
 
                        // only got 2 parts and that the first part is not zero in length
406
 
                        String[] parts = line.split( ":", 2 );
407
 
                        if( parts.length == 2 && parts[ 0 ].length() > 0 )
408
 
                                ret = parts[ former? 0 : 1 ];
409
 
 
410
 
                        return ret;
411
 
                }
412
 
 
413
 
                private String extractNameAndParamsFromLine( ByteBuffer buffer,
414
 
                        String line )
415
 
                {
416
 
                        return extractCollonPartFromLine( buffer, line, true );
417
 
                }
418
 
 
419
 
                private String extractValueFromLine( ByteBuffer buffer, String line )
420
 
                {
421
 
                        return extractCollonPartFromLine( buffer, line, false );
422
 
                }
423
 
 
424
 
                public void parseLine( ByteBuffer buffer, String line,
425
 
                        boolean next_line_looks_folded )
426
 
                        throws ParseException, SkipContactException,
427
 
                        AbortImportException
428
 
                {
429
 
                        // do we have a version yet?
 
337
                public void parseLine( ByteBuffer buffer )
 
338
                                throws ParseException, SkipContactException,
 
339
                                AbortImportException
 
340
                {
 
341
                        // get a US-ASCII version of the line for processing
 
342
                        String line;
 
343
                        try {
 
344
                                line = new String( buffer.array(), buffer.position(),
 
345
                                        buffer.limit() - buffer.position(), "US-ASCII" );
 
346
                        }
 
347
                        catch( UnsupportedEncodingException e ) {
 
348
                                // we know US-ASCII is supported, so appease the compiler...
 
349
                                line = "";
 
350
                        }
 
351
 
 
352
                        // ignore empty lines
 
353
                        if( line.trim().equals( "" ) ) return;
 
354
 
 
355
                        // split line into name and value parts (this may turn out to be
 
356
                        // unwanted if the line is a subsequent line in a multi-line
 
357
                        // value, but we have to do this now to check for and handle VCF
 
358
                        // versions first). Also, the value part is only created tentatively
 
359
                        // because it may have an encoding/charset. Since we're treating it
 
360
                        // as UTF-8 (which is compatible with 7-bit US-ASCII) this is ok
 
361
                        // though so long as we later use the raw bytes. ALso we check for
 
362
                        // malformed property:name pairs.
 
363
                        String name_and_params, string_value;
 
364
                        {
 
365
                                String[] parts = line.split( ":", 2 );
 
366
                                if( parts.length == 2 ) {
 
367
                                        name_and_params = parts[ 0 ].trim();
 
368
                                        string_value = parts[ 1 ].trim();
 
369
                                        if( name_and_params.length() == 0 )
 
370
                                                throw new ParseException( R.string.error_vcf_malformed );
 
371
                                }
 
372
                                else
 
373
                                {
 
374
                                        if( !_parser_in_multiline )
 
375
                                                throw new ParseException( R.string.error_vcf_malformed );
 
376
                                        name_and_params = null;
 
377
                                        string_value = null;
 
378
                                }
 
379
                        }
 
380
 
 
381
                        // if we haven't yet got a version, we won't be paring anything!
430
382
                        if( _version == null )
431
383
                        {
432
 
                                // tentatively get name and params from line
433
 
                                String name_and_params =
434
 
                                        extractNameAndParamsFromLine( buffer, line );
435
 
 
436
 
                                // is it a version line?
437
 
                                if( name_and_params != null &&
438
 
                                        name_and_params.equals( "VERSION" ) )
 
384
                                // is this a version?
 
385
                                if( name_and_params.equals( "VERSION" ) )
439
386
                                {
440
 
                                        // yes, get it!
441
 
                                        String value = extractValueFromLine( buffer, line );
442
 
                                        if( !value.equals( "2.1" ) && !value.equals( "3.0" ) )
 
387
                                        // yes, check/store it
 
388
                                        if( !string_value.equals( "2.1" ) &&
 
389
                                                        !string_value.equals( "3.0" ) )
443
390
                                                throw new ParseException( R.string.error_vcf_version );
444
 
                                        _version = value;
 
391
                                        _version = string_value;
445
392
 
446
 
                                        // parse any buffers we've been accumulating while we waited
447
 
                                        // for a version
 
393
                                        // parse any other buffers we've accumulated so far
448
394
                                        if( _buffers != null )
449
395
                                                for( int i = 0; i < _buffers.size(); i++ )
450
 
                                                        parseLine( _buffers.get( i ), null,
451
 
                                                                i + 1 < _buffers.size() &&
452
 
                                                                _buffers.get( i + 1 ).hasRemaining() &&
453
 
                                                                _buffers.get( i + 1 ).get(
454
 
                                                                        _buffers.get( i + 1 ).position() ) == ' ' );
 
396
                                                        parseLine( _buffers.get( i ) );
455
397
                                        _buffers = null;
456
398
                                }
457
399
                                else
458
400
                                {
459
 
                                        // no, so stash this line till we get a version
 
401
                                        // no, so stash this buffer till we have a version
460
402
                                        if( _buffers == null )
461
403
                                                _buffers = new Vector< ByteBuffer >();
462
404
                                        _buffers.add( buffer );
464
406
                        }
465
407
                        else
466
408
                        {
467
 
                                // name and params and the position in the buffer where the
468
 
                                // "value" part of the line start
469
 
                                String name_and_params;
470
 
                                int pos;
 
409
                                // value bytes, for processing
 
410
                                ByteBuffer value;
471
411
 
472
 
                                if( _parser_in_encoded_multiline ||
473
 
                                        _parser_in_folded_multiline )
 
412
                                if( _parser_in_multiline )
474
413
                                {
475
414
                                        // if we're currently in a multi-line value, use the stored
476
415
                                        // property name and parameters
477
416
                                        name_and_params = _parser_current_name_and_params;
478
417
 
479
 
                                        pos = buffer.position();
480
 
 
481
 
                                        // for folded multi-lines, skip the single space at the
482
 
                                        // start of the next line
483
 
                                        if( _parser_in_folded_multiline )
 
418
                                        // find start of string (skip spaces/tabs)
 
419
                                        int pos = buffer.position();
 
420
                                        byte[] buffer_array = buffer.array();
 
421
                                        while( pos < buffer.limit() && (
 
422
                                                buffer_array[ pos ] == ' ' ||
 
423
                                                buffer_array[ pos ] == '\t' ) )
 
424
                                        {
484
425
                                                pos++;
 
426
                                        }
485
427
 
486
 
                                        // else, this must be an encoded multi-line, so skip any
487
 
                                        // whitespace we find at the start of the next line
488
 
                                        else
489
 
                                                while( pos < buffer.limit() && (
490
 
                                                        buffer.get( pos ) == ' ' ||
491
 
                                                        buffer.get( pos ) == '\t' ) )
492
 
                                                {
493
 
                                                        pos++;
494
 
                                                }
 
428
                                        // get value from buffer
 
429
                                        value = ByteBuffer.wrap( buffer.array(), pos,
 
430
                                                buffer.limit() - pos );
495
431
                                }
496
432
                                else
497
433
                                {
498
 
                                        // get name and params from line, and since we're not
499
 
                                        // parsing a subsequent line in a multi-line, this should
500
 
                                        // not fail, or it's an error
501
 
                                        name_and_params =
502
 
                                                extractNameAndParamsFromLine( buffer, line );
503
 
                                        if( name_and_params == null )
504
 
                                                throw new ParseException(
505
 
                                                        R.string.error_vcf_malformed );
506
 
 
507
434
                                        // calculate how many chars to skip from beginning of line
508
435
                                        // so we skip the property "name:" part
509
 
                                        pos = buffer.position() + name_and_params.length() + 1;
 
436
                                        int pos = buffer.position() + name_and_params.length() + 1;
 
437
 
 
438
                                        // get value from buffer
 
439
                                        value = ByteBuffer.wrap( buffer.array(), pos,
 
440
                                                buffer.limit() - pos );
510
441
 
511
442
                                        // reset the saved multi-line state
512
443
                                        _parser_current_name_and_params = name_and_params;
513
444
                                        _parser_buffered_value_so_far = "";
514
445
                                }
515
446
 
516
 
                                // get value from buffer, as raw bytes
517
 
                                ByteBuffer value;
518
 
                                value = ByteBuffer.wrap( buffer.array(), pos,
519
 
                                        buffer.limit() - pos );
520
 
 
521
447
                                // get parameter parts
522
448
                                String[] name_param_parts = name_and_params.split( ";", -1 );
523
449
                                for( int i = 0; i < name_param_parts.length; i++ )
537
463
                                String charset = checkParam( name_param_parts, "CHARSET" );
538
464
                                if( charset != null ) charset = charset.toUpperCase();
539
465
                                if( charset != null && !charset.equals( "US-ASCII" ) &&
540
 
                                        !charset.equals( "ASCII" ) &&
541
 
                                        !charset.equals( "UTF-8" ) )
 
466
                                        !charset.equals( "ASCII" ) && !charset.equals( "UTF-8" ) )
542
467
                                {
543
468
                                        throw new ParseException( R.string.error_vcf_charset );
544
469
                                }
552
477
//                                      unencoding_result = unencodeBase64( props[ 1 ], charset );
553
478
                                if( unencoding_result != null ) {
554
479
                                        value = unencoding_result.getBuffer();
555
 
                                        _parser_in_encoded_multiline =
 
480
                                        _parser_in_multiline =
556
481
                                                unencoding_result.isAnotherLineRequired();
557
482
                                }
558
483
 
563
488
                                }
564
489
 
565
490
                                // process charset
566
 
                                String string_value;
567
491
                                try {
568
 
                                        string_value = new String( value.array(), value.position(),
569
 
                                                value.limit() - value.position(), charset );
 
492
                                        string_value =
 
493
                                                new String( value.array(), value.position(),
 
494
                                                        value.limit() - value.position(), charset );
570
495
                                } catch( UnsupportedEncodingException e ) {
571
496
                                        throw new ParseException( R.string.error_vcf_charset );
572
497
                                }
573
498
 
574
 
                                // now we know whether we're in an encoding multi-line,
575
 
                                // determine if we're in a v3 folded multi-line or not
576
 
                                _parser_in_folded_multiline = !_parser_in_encoded_multiline &&
577
 
                                        _version.equals( "3.0" ) && next_line_looks_folded;
578
 
 
579
499
                                // handle multi-line requests
580
 
                                if( _parser_in_encoded_multiline ||
581
 
                                        _parser_in_folded_multiline )
582
 
                                {
 
500
                                if( _parser_in_multiline ) {
583
501
                                        _parser_buffered_value_so_far += string_value;
584
502
                                        return;
585
503
                                }
606
524
                }
607
525
 
608
526
                private void parseN( String[] params, String value )
609
 
                        throws ParseException, SkipContactException,
610
 
                        AbortImportException
 
527
                                throws ParseException, SkipContactException,
 
528
                                AbortImportException
611
529
                {
612
530
                        // already got a better name?
613
531
                        if( _name_level >= NAMELEVEL_N ) return;
635
553
                }
636
554
 
637
555
                private void parseFN( String[] params, String value )
638
 
                        throws ParseException, SkipContactException
 
556
                                throws ParseException, SkipContactException
639
557
                {
640
558
                        // already got a better name?
641
559
                        if( _name_level >= NAMELEVEL_FN ) return;
646
564
                }
647
565
 
648
566
                private void parseORG( String[] params, String value )
649
 
                        throws ParseException, SkipContactException
 
567
                                throws ParseException, SkipContactException
650
568
                {
651
569
                        // already got a better name?
652
570
                        if( _name_level >= NAMELEVEL_ORG ) return;
668
586
                }
669
587
 
670
588
                private void parseTEL( String[] params, String value )
671
 
                        throws ParseException
 
589
                                throws ParseException
672
590
                {
673
591
                        if( value.length() == 0 ) return;
674
592
 
675
593
                        Set< String > types = extractTypes( params, Arrays.asList(
676
 
                                "PREF", "HOME", "WORK", "VOICE", "FAX", "MSG", "CELL",
677
 
                                "PAGER", "BBS", "MODEM", "CAR", "ISDN", "VIDEO" ) );
 
594
                                        "PREF", "HOME", "WORK", "VOICE", "FAX", "MSG", "CELL",
 
595
                                        "PAGER", "BBS", "MODEM", "CAR", "ISDN", "VIDEO" ) );
678
596
 
679
597
                        // here's the logic...
680
598
                        boolean preferred = types.contains( "PREF" );
699
617
                }
700
618
 
701
619
                public void parseEMAIL( String[] params, String value )
702
 
                        throws ParseException
 
620
                                throws ParseException
703
621
                {
704
622
                        if( value.length() == 0 ) return;
705
623
 
706
624
                        Set< String > types = extractTypes( params, Arrays.asList(
707
 
                                "PREF", "WORK", "HOME", "INTERNET" ) );
 
625
                                        "PREF", "WORK", "HOME", "INTERNET" ) );
708
626
 
709
627
                        // here's the logic...
710
628
                        boolean preferred = types.contains( "PREF" );
715
633
                }
716
634
 
717
635
                public void finaliseParsing()
718
 
                        throws ParseException, SkipContactException,
719
 
                        AbortImportException
 
636
                                throws ParseException, SkipContactException,
 
637
                                AbortImportException
720
638
                {
721
639
                        // missing version (and data is present)
722
640
                        if( _version == null && _buffers != null )
736
654
                private String checkParam( String[] params, String name )
737
655
                {
738
656
                        Pattern p = Pattern.compile(
739
 
                                "^" + name + "[ \\t]*=[ \\t]*(\"?)(.*)\\1$" );
 
657
                                        "^" + name + "[ \\t]*=[ \\t]*(\"?)(.*)\\1$" );
740
658
                        for( int i = 0; i < params.length; i++ ) {
741
659
                                Matcher m = p.matcher( params[ i ] );
742
660
                                if( m.matches() )
746
664
                }
747
665
 
748
666
                private Set< String > extractTypes( String[] params,
749
 
                        List< String > valid_types )
 
667
                                List< String > valid_types )
750
668
                {
751
669
                        HashSet< String > types = new HashSet< String >();
752
670
 
773
691
                {
774
692
                        boolean another = false;
775
693
 
776
 
                        // unencode quoted-printable encoding, as per RFC1521 section 5.1
 
694
                        // unencode quoted-pritable encoding, as per RFC1521 section 5.1
777
695
                        byte[] out = new byte[ in.limit() - in.position() ];
778
696
                        int j = 0;
779
697
                        for( int i = in.position(); i < in.limit(); i++ )
784
702
                                {
785
703
                                        // we found a =XX format byte, add it
786
704
                                        out[ j ] = (byte)(
787
 
                                                        Character.digit( in.array()[ i + 1 ], 16 ) * 16 +
788
 
                                                        Character.digit( in.array()[ i + 2 ], 16 ) );
 
705
                                                Character.digit( in.array()[ i + 1 ], 16 ) * 16 +
 
706
                                                Character.digit( in.array()[ i + 2 ], 16 ) );
789
707
                                        i += 2;
790
708
                                }
791
709
                                else if( ch == '=' && i == in.limit() - 1 )