I have a below snippet which works perfectly in Grrovy, now am trying to convert it to java but am getting
protected String[] extractText(byte[] fileData) {
//Remove the BOM if present
if (fileData.length > 3 && fileData[0..2] == [0xEF, 0xBB, 0xBF] as byte[])
{
fileData = fileData[3..fileData.length-1]
}
// method implemaentation
}
I tried changing it as below but am getting Incompatible operand types byte and byte[]
compiler error
byte[] array= { (byte)0xEF, (byte)0xBB, (byte)0xBF };
fileData.length > 3 && fileData[0..2] == array
I've never worked with byte arrays, Could anyone please help me with this?