@Override
    SortableFeature readNextFeature() {
      if (read < count) {
        try {
          long nextSort = input.readLong();
          int length = input.readInt();
          byte[] bytes = input.readNBytes(length);
          read++;
          return new SortableFeature(nextSort, bytes);
        } catch (IOException e) {
          throw new UncheckedIOException(e);
        }
      } else {
        return null;
      }
    }
Read all features from a chunk file using a {@link BufferedInputStream}.
planetiler-core/src/main/java/com/onthegomap/planetiler/collection/ExternalMergeSort.java