Java Code Examples for org.apache.commons.io.ByteOrderMark#length()
The following examples show how to use
org.apache.commons.io.ByteOrderMark#length() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextInput.java From dremio-oss with Apache License 2.0 | 6 votes |
private final boolean checkBom(ByteOrderMark bom) { int bomLength = bom.length(); if (bufferPtr + bomLength >= length) { // Not enough bytes from the current position to the end of the buffer return false; } if (BoundsChecking.BOUNDS_CHECKING_ENABLED) { buffer.checkBytes(bufferPtr - 1, bufferPtr + bomLength); } byte[] bomBytes = bom.getBytes(); for (int i = 0; i < bomLength; i++) { byte nextChar = PlatformDependent.getByte(bStartMinus1 + bufferPtr + i); if (nextChar != bomBytes[i]) { // No BOM. Position is unchanged return false; } } return true; }
Example 2
Source File: BOMInputStream.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public int compare(ByteOrderMark bom1, ByteOrderMark bom2) { int len1 = bom1.length(); int len2 = bom2.length(); if (len1 > len2) { return -1; } if (len2 > len1) { return 1; } return 0; }
Example 3
Source File: BOMInputStream.java From aion-germany with GNU General Public License v3.0 | 5 votes |
/** * Check if the bytes match a BOM. * * @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; }
Example 4
Source File: BOMInputStream.java From lams with GNU General Public License v2.0 | 5 votes |
public int compare(final ByteOrderMark bom1, final ByteOrderMark bom2) { final int len1 = bom1.length(); final int len2 = bom2.length(); if (len1 > len2) { return EOF; } if (len2 > len1) { return 1; } return 0; }
Example 5
Source File: BOMInputStream.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Check if the bytes match a BOM. * * @param bom * The BOM * @return true if the bytes match the bom, otherwise false */ private boolean matches(final 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; }