@SuppressWarnings("ConstantConditions")
  private static Object streamInfo(@NotNull InputStream stream) throws IOException {
    if (stream instanceof BufferedInputStream) {
      InputStream in = ReflectionUtil.getField(stream.getClass(), stream, InputStream.class, "in");
      byte[] buf = ReflectionUtil.getField(stream.getClass(), stream, byte[].class, "buf");
      int count = ReflectionUtil.getField(stream.getClass(), stream, int.class, "count");
      int pos = ReflectionUtil.getField(stream.getClass(), stream, int.class, "pos");
      String buffer = buf == null ? null : Arrays.toString(Arrays.copyOf(buf, Math.min(count, OUR_MAX_FILE_SIZE_TO_LOG)));
      return "BufferedInputStream(buf=" + buffer + ", count=" + count + ", pos=" + pos + ", in=" + streamInfo(in) + ")";
    }
    if (stream instanceof FileInputStream) {
      String path = ReflectionUtil.getField(stream.getClass(), stream, String.class, "path");
      FileChannel channel = ReflectionUtil.getField(stream.getClass(), stream, FileChannel.class, "channel");
      boolean closed = ReflectionUtil.getField(stream.getClass(), stream, boolean.class, "closed");
      int available = stream.available();
      File file = new File(path);
      Long channelSize = channel == null ? null : channel.size();
      String fileContent = loadFile(file, OUR_MAX_FILE_SIZE_TO_LOG);
      return "FileInputStream(path=" + path + ", available=" + available + ", closed=" + closed +
             ", channel=" + channel + ", channel.size=" + channelSize +
             ", file.exists=" + file.exists() + ", file.content='" + fileContent + "')";
    }
    return stream;
  }
@SuppressWarnings("ConstantConditions")
  private static Object streamInfo(@NotNull InputStream stream)