void walkTreeAndWriteData(BufferedWriter writer, boolean isHistogram) throws Exception {
        harvestTallySets();
        for (BinaryTreePayload payload : tallySetCache) {
            TallySet tallySet = (TallySet) payload;
            long location = tallySet.getLocation();
            long[] tallies = tallySet.readTallies();
            for (int i = 0; i < tallies.length; i++) {
                if (tallies[i] > 0) {
                    if (isHistogram) {
                        writer.write(String.valueOf(location + i) + " - " + tallies[i] + FileUtils.NEWLINE);
                    } else {
                        for (int j = 0; j < tallies[i]; j++) {
                            writer.write(String.valueOf(location + i) + FileUtils.NEWLINE);
                        }
                    }
                }
            }
        }
    }