renamed ambiguous getBom to getPossibleBom

This commit is contained in:
Alexey Kudravtsev
2016-10-07 12:26:27 +03:00
parent 3c412457cf
commit a05c96972e
2 changed files with 6 additions and 2 deletions
@@ -129,7 +129,7 @@ public class ExternalDiffToolUtil {
byte[] bytes = contentData.getBytes(charset);
byte[] bom = hasBom ? CharsetToolkit.getBom(charset) : null;
byte[] bom = hasBom ? CharsetToolkit.getPossibleBom(charset) : null;
if (bom != null) {
bytes = ArrayUtil.mergeArrays(bom, bytes);
}
@@ -624,8 +624,12 @@ public class CharsetToolkit {
return CHARSET_TO_MANDATORY_BOM.get(charset);
}
/**
* @return BOM which can be associated with this charset, or null otherwise.
* Currently these are UTF-16xx, UTF-32xx and UTF-8.
*/
@Nullable
public static byte[] getBom(@NotNull Charset charset) {
public static byte[] getPossibleBom(@NotNull Charset charset) {
if (charset.equals(UTF8_CHARSET)) return UTF8_BOM;
return CHARSET_TO_MANDATORY_BOM.get(charset);
}