* @throws IOException
* read errors.
*/
private ExtendedContentDescription parseData(RandomAccessFile raf)
throws IOException {
ExtendedContentDescription result = null;
long chunkStart = raf.getFilePointer();
GUID guid = Utils.readGUID(raf);
if (GUID.GUID_EXTENDED_CONTENT_DESCRIPTION.equals(guid)) {
BigInteger chunkLen = Utils.readBig64(raf);
// Reading Number of Tags.
long descriptorCount = Utils.readUINT16(raf);
// Create Result object
result = new ExtendedContentDescription(chunkStart, chunkLen);
for (long i = 0; i < descriptorCount; i++) {
String tagElement = Utils.readUTF16LEStr(raf);
int type = Utils.readUINT16(raf);
ContentDescriptor prop = new ContentDescriptor(tagElement, type);
switch (type) {
case ContentDescriptor.TYPE_STRING:
prop.setStringValue(Utils.readUTF16LEStr(raf));
break;
case ContentDescriptor.TYPE_BINARY:
prop.setBinaryValue(readBinaryData(raf));
break;
case ContentDescriptor.TYPE_BOOLEAN:
prop.setBooleanValue(readBoolean(raf));
break;
case ContentDescriptor.TYPE_DWORD:
raf.skipBytes(2);
prop.setDWordValue(Utils.readUINT32(raf));
break;
case ContentDescriptor.TYPE_WORD:
raf.skipBytes(2);
prop.setWordValue(Utils.readUINT16(raf));
break;
case ContentDescriptor.TYPE_QWORD:
raf.skipBytes(2);
prop.setQWordValue(Utils.readUINT64(raf));
break;
default:
// Unknown, hopefully the convention for the size of the
// value
// is given, so we could read it binary
prop.setStringValue("Invalid datatype: "
+ new String(readBinaryData(raf)));
}
result.addDescriptor(prop);
}
}
return result;
}