List of usage examples for org.apache.commons.io ByteOrderMark get
public int get(int pos)
From source file:com.examples.with.different.packagename.idnaming.BOMInputStream.java
/** * Check if the bytes match a BOM.//from w w w .j a v a2 s.com * * @param bom * The BOM * @return true if the bytes match the bom, otherwise false */ private boolean matches(ByteOrderMark bom) { // if (bom.length() != fbLength) { // return false; // } // firstBytes may be bigger than the BOM bytes for (int i = 0; i < bom.length(); i++) { if (bom.get(i) != firstBytes[i]) { return false; } } return true; }
From source file:org.sonar.scanner.scan.filesystem.ByteCharsetDetector.java
private static boolean isBom(ByteOrderMark bom, byte[] buffer) { if (buffer.length < bom.length()) { return false; }//www . j av a 2s .co m for (int i = 0; i < bom.length(); i++) { if ((byte) bom.get(i) != buffer[i]) { return false; } } return true; }