public static byte [ ] dropUTF8BOM ( final byte [ ] source ) { if ( source == null ) { return null ; } if ( source . length < 3 ) { return source ; } if ( ( source [ 0 ] == ( byte ) 0xef ) && ( source [ 1 ] == ( byte ) 0xbb ) && ( source [ 2 ] == ( byte ) 0xbf ) ) { return Arrays . copyOfRange ( source , 3 , source . length ) ; } return source ; }
Silently drop UTF8 BOM