@Override
  public void allocatedResourceType(ResourceType resourceType) {
    if (logger.isTraceEnabled(LogMarker.STATISTICS_VERBOSE)) {
      logger.trace(LogMarker.STATISTICS_VERBOSE,
          "StatArchiveWriter#allocatedResourceType resourceType={}", resourceType);
    }
    if (resourceType.getStatisticDescriptors().length >= ILLEGAL_STAT_OFFSET) {
      throw new InternalGemFireException(
          String.format("Could not archive type %s because it had more than %s statistics.",
              resourceType.getStatisticsType().getName(),
              ILLEGAL_STAT_OFFSET - 1));
    }
    // write the type to the archive
    try {
      dataOut.writeByte(RESOURCE_TYPE_TOKEN);
      dataOut.writeInt(resourceType.getId());
      dataOut.writeUTF(resourceType.getStatisticsType().getName());
      dataOut.writeUTF(resourceType.getStatisticsType().getDescription());
      StatisticDescriptor[] stats = resourceType.getStatisticDescriptors();
      dataOut.writeShort(stats.length);
      if (trace && (traceStatisticsTypeName == null
          || traceStatisticsTypeName.equals(resourceType.getStatisticsType().getName()))) {
        traceDataOut
            .println("allocatedResourceType#writeByte RESOURCE_TYPE_TOKEN: " + RESOURCE_TYPE_TOKEN);
        traceDataOut.println(
            "allocatedResourceType#writeInt resourceType.getId(): " + resourceType.getId());
        traceDataOut
            .println("allocatedResourceType#writeUTF resourceType.getStatisticsType().getName(): "
                + resourceType.getStatisticsType().getName());
        traceDataOut.println(
            "allocatedResourceType#writeUTF resourceType.getStatisticsType().getDescription(): "
                + resourceType.getStatisticsType().getDescription());
        traceDataOut.println("allocatedResourceType#writeShort stats.length: " + stats.length);
      }
      for (final StatisticDescriptor stat : stats) {
        dataOut.writeUTF(stat.getName());
        dataOut.writeByte(((StatisticDescriptorImpl) stat).getTypeCode());
        dataOut.writeBoolean(stat.isCounter());
        dataOut.writeBoolean(stat.isLargerBetter());
        dataOut.writeUTF(stat.getUnit());
        dataOut.writeUTF(stat.getDescription());
        if (trace && (traceStatisticsTypeName == null
            || traceStatisticsTypeName.equals(resourceType.getStatisticsType().getName()))) {
          traceDataOut
              .println("allocatedResourceType#writeUTF stats[i].getName(): " + stat.getName());
          traceDataOut.println(
              "allocatedResourceType#writeByte ((StatisticDescriptorImpl)stats[i]).getTypeCode(): "
                  + ((StatisticDescriptorImpl) stat).getTypeCode());
          traceDataOut.println(
              "allocatedResourceType#writeBoolean stats[i].isCounter(): " + stat.isCounter());
          traceDataOut.println("allocatedResourceType#writeBoolean stats[i].isLargerBetter(): "
              + stat.isLargerBetter());
          traceDataOut
              .println("allocatedResourceType#writeUTF stats[i].getUnit(): " + stat.getUnit());
          traceDataOut.println("allocatedResourceType#writeUTF stats[i].getDescription(): "
              + stat.getDescription());
        }
      }
    } catch (IOException ex) {
      throw new GemFireIOException(
          "Failed writing new resource type to statistic archive",
          ex);
    }
  }
Returns the number of bytes written so far to this archive. This does not take compression into
account.
geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveWriter.java