@SuppressWarnings("DuplicatedCode")
  private static byte @NotNull [] loadBytes(@NotNull InputStream stream, int length) throws IOException {
    byte[] bytes = new byte[length];
    int count = 0;
    while (count < length) {
      int n = stream.read(bytes, count, length - count);
      if (n <= 0) break;
      count += n;
    }
    return bytes;
  }
@SuppressWarnings("DuplicatedCode")
  private static byte @NotNull [] loadBytes(@NotNull InputStream stream, int length)