public static @Nullable Charset guessFromBOM(byte @NotNull [] buffer) {
    if (hasUTF8Bom(buffer)) return StandardCharsets.UTF_8;
    if (hasUTF32BEBom(buffer)) return UTF_32BE_CHARSET;
    if (hasUTF32LEBom(buffer)) return UTF_32LE_CHARSET;
    if (hasUTF16LEBom(buffer)) return StandardCharsets.UTF_16LE;
    if (hasUTF16BEBom(buffer)) return StandardCharsets.UTF_16BE;

    return null;
  }
public static @Nullable Charset guessFromBOM(byte @NotNull [] buffer)