code: private static void outputTzdbDat(OutputStream jos,
              Map<String, SortedMap<String, ZoneRules>> allBuiltZones,
              Set<String> allRegionIds, Set<ZoneRules> allRules) throws IOException {
          DataOutputStream out = new DataOutputStream(jos);
  
          // file version
          out.writeByte(1);
          // group
          out.writeUTF("TZDB");
          // versions
          String[] versionArray = allBuiltZones.keySet().toArray(new String[allBuiltZones.size()]);
          out.writeShort(versionArray.length);
          for (String version : versionArray) {
              out.writeUTF(version);
          }
          // regions
          String[] regionArray = allRegionIds.toArray(new String[allRegionIds.size()]);
          out.writeShort(regionArray.length);
          for (String regionId : regionArray) {
              out.writeUTF(regionId);
          }
          // rules
          List<ZoneRules> rulesList = new ArrayList<ZoneRules>(allRules);
          out.writeShort(rulesList.size());
          ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
          for (ZoneRules rules : rulesList) {
              baos.reset();
              DataOutputStream dataos = new DataOutputStream(baos);
              Ser.write(rules, dataos);
              dataos.close();
              byte[] bytes = baos.toByteArray();
              out.writeShort(bytes.length);
              out.write(bytes);
          }
          // link version-region-rules
          for (String version : allBuiltZones.keySet()) {
              out.writeShort(allBuiltZones.get(version).size());
              for (Map.Entry<String, ZoneRules> entry : allBuiltZones.get(version).entrySet()) {
                   int regionIndex = Arrays.binarySearch(regionArray, entry.getKey());
                   int rulesIndex = rulesList.indexOf(entry.getValue());
                   out.writeShort(regionIndex);
                   out.writeShort(rulesIndex);
              }
          }
          out.flush();
      }
docs: Outputs the timezone DAT file.