private static byte[] readNBytes(@NotNull InputStream is, int length) throws IOException {
    byte[] bytes = ArrayUtil.newByteArray(length);

    int n = 0;
    int off = 0;
    while (n < length) {
      int count = is.read(bytes, off + n, length - n);
      if (count < 0) {
        throw new EOFException();
      }
      n += count;
    }

    return bytes;
  }
private static byte[] readNBytes(@NotNull InputStream is, int length)