docs: @Nullable
      public static String readUTF(@NotNull final InputStream stream) throws IOException {
          final DataInputStream dataInput = new DataInputStream(stream);
          if (stream instanceof ByteArraySizedInputStream) {
              final ByteArraySizedInputStream sizedStream = (ByteArraySizedInputStream) stream;
              final int streamSize = sizedStream.size();
              if (streamSize >= 2) {
                  sizedStream.mark(Integer.MAX_VALUE);
                  final int utfLen = dataInput.readUnsignedShort();
                  if (utfLen == streamSize - 2) {
                      boolean isAscii = true;
                      final byte[] bytes = sizedStream.toByteArray();
                      for (int i = 0; i < utfLen; ++i) {
                          if ((bytes[i + 2] & 0xff) > 127) {
                              isAscii = false;
                              break;
                          }
                      }
                      if (isAscii) {
                          return fromAsciiByteArray(bytes, 2, utfLen);
                      }
                  }
                  sizedStream.reset();
              }
          }
          try {
              String result = null;
              StringBuilder builder = null;
              for (; ; ) {
                  final String temp;
                  try {
                      temp = dataInput.readUTF();
                      if (result != null && result.length() == 0 &&
                          builder != null && builder.length() == 0 && temp.length() == 0) {
                          break;
                      }
                  } catch (EOFException e) {
                      break;
                  }
                  if (result == null) {
                      result = temp;
                  } else {
                      if (builder == null) {
                          builder = new StringBuilder();
                          builder.append(result);
                      }
                      builder.append(temp);
                  }
              }
              return (builder != null) ? builder.toString() : result;
          } finally {
              dataInput.close();
          }
      }