629 for (byte tag = CONSTANT_GroupFirst; tag < CONSTANT_GroupLimit; tag++) {
630 Index index = cp.getIndexByTag(tag);
631 if (index == null || index.isEmpty()) continue;
632 Entry[] cpMap = index.cpMap;
633 if (verbose > 1)
634 Utils.log.info("Index group "+ConstantPool.tagName(tag)+" contains "+cpMap.length+" entries.");
635 if (optDumpBands) {
636 try (PrintStream ps = new PrintStream(getDumpStream(index.debugName, tag, ".gidx", index))) {
637 printArrayTo(ps, cpMap, 0, cpMap.length, true);
638 }
639 }
640 }
641 }
642 }
643
644 void writeUtf8Bands(Entry[] cpMap) throws IOException {
645 if (cpMap.length == 0)
646 return; // nothing to write
647
648 // The first element must always be the empty string.
649 assert(cpMap[0].stringValue().equals(""));
650 final int SUFFIX_SKIP_1 = 1;
651 final int PREFIX_SKIP_2 = 2;
652
653 // Fetch the char arrays, first of all.
654 char[][] chars = new char[cpMap.length][];
655 for (int i = 0; i < chars.length; i++) {
656 chars[i] = cpMap[i].stringValue().toCharArray();
657 }
658
659 // First band: Write lengths of shared prefixes.
660 int[] prefixes = new int[cpMap.length]; // includes 2 skipped zeroes
661 char[] prevChars = {};
662 for (int i = 0; i < chars.length; i++) {
663 int prefix = 0;
664 char[] curChars = chars[i];
665 int limit = Math.min(curChars.length, prevChars.length);
666 while (prefix < limit && curChars[prefix] == prevChars[prefix])
667 prefix++;
668 prefixes[i] = prefix;
669 if (i >= PREFIX_SKIP_2)
|
629 for (byte tag = CONSTANT_GroupFirst; tag < CONSTANT_GroupLimit; tag++) {
630 Index index = cp.getIndexByTag(tag);
631 if (index == null || index.isEmpty()) continue;
632 Entry[] cpMap = index.cpMap;
633 if (verbose > 1)
634 Utils.log.info("Index group "+ConstantPool.tagName(tag)+" contains "+cpMap.length+" entries.");
635 if (optDumpBands) {
636 try (PrintStream ps = new PrintStream(getDumpStream(index.debugName, tag, ".gidx", index))) {
637 printArrayTo(ps, cpMap, 0, cpMap.length, true);
638 }
639 }
640 }
641 }
642 }
643
644 void writeUtf8Bands(Entry[] cpMap) throws IOException {
645 if (cpMap.length == 0)
646 return; // nothing to write
647
648 // The first element must always be the empty string.
649 assert(cpMap[0].stringValue().isEmpty());
650 final int SUFFIX_SKIP_1 = 1;
651 final int PREFIX_SKIP_2 = 2;
652
653 // Fetch the char arrays, first of all.
654 char[][] chars = new char[cpMap.length][];
655 for (int i = 0; i < chars.length; i++) {
656 chars[i] = cpMap[i].stringValue().toCharArray();
657 }
658
659 // First band: Write lengths of shared prefixes.
660 int[] prefixes = new int[cpMap.length]; // includes 2 skipped zeroes
661 char[] prevChars = {};
662 for (int i = 0; i < chars.length; i++) {
663 int prefix = 0;
664 char[] curChars = chars[i];
665 int limit = Math.min(curChars.length, prevChars.length);
666 while (prefix < limit && curChars[prefix] == prevChars[prefix])
667 prefix++;
668 prefixes[i] = prefix;
669 if (i >= PREFIX_SKIP_2)
|