I am looking for a utility method or constant in Java that will return me the bytes that correspond to the appropriate byte order mark for an encoding, but I can't seem to find one. Is there one? I really would like to do something like:
byte[] bom = Charset.forName( CharEncoding.UTF8 ).getByteOrderMark();
Where CharEncoding
comes from Apache Commons.