@NotNull
  private static LinkedHashMap<String, Optional<String>> deserializeFields(@NotNull StubInputStream stream, int fieldsSize)
    throws IOException {
    final LinkedHashMap<String, Optional<String>> fields = new LinkedHashMap<>(fieldsSize);

    for (int i = 0; i < fieldsSize; i++) {
      final String name = stream.readNameString();
      final String type = stream.readNameString();

      if (name != null) {
        fields.put(name, Optional.ofNullable(type));
      }
    }

    return fields;
  }
@NotNull
  private static LinkedHashMap<String, Optional<String>> deserializeFields(@NotNull StubInputStream stream, int fieldsSize)