public static byte @NotNull [] loadNBytes(@NotNull VirtualFile virtualFile, int maxLength) throws IOException {
    try (InputStream stream = virtualFile.getInputStream()) {
      byte[] buffer = new byte[(int)Math.min(maxLength, virtualFile.getLength())];
      byte[] bom = virtualFile.getBOM();
      int o = 0;
      if (bom != null) {
        System.arraycopy(bom, 0, buffer, 0, bom.length);
        o = bom.length;
      }
      int n;
      int nread = o;
      while ((n = stream.read(buffer, nread, buffer.length - nread)) > 0) {
        nread += n;
      }
      return nread == buffer.length ? buffer : Arrays.copyOf(buffer, nread);
    }
  }
public static byte @NotNull [] loadNBytes(@NotNull VirtualFile virtualFile, int maxLength)