private static int indexOfEOS(byte[] data, int fromIndex, int encodingByte) { int terminationPos = indexOf(data, fromIndex, (byte) 0); // For single byte encoding charsets, we are done if (encodingByte == ID3_TEXT_ENCODING_ISO_8859_1 || encodingByte == ID3_TEXT_ENCODING_UTF_8) { return terminationPos; } // Otherwise, look for a two zero bytes while (terminationPos < data.length - 1) { if (data[terminationPos + 1] == (byte) 0) { return terminationPos; } terminationPos = indexOf(data, terminationPos + 1, (byte) 0); } return data.length; }
id3Data.readBytes(frame, 0, frameSize); int firstZeroIndex = indexOf(frame, 0, (byte) 0); String owner = new String(frame, 0, firstZeroIndex, "ISO-8859-1"); byte[] privateData = new byte[frameSize - firstZeroIndex - 1]; id3Data.readBytes(frame, 0, frameSize - 1); int firstZeroIndex = indexOf(frame, 0, (byte) 0); String mimeType = new String(frame, 0, firstZeroIndex, "ISO-8859-1"); int filenameStartIndex = firstZeroIndex + 1;