* @param raf
* @return <code>null</code> if no valid file header object.
* @throws IOException
*/
private FileHeader parseData(RandomAccessFile raf) throws IOException {
FileHeader result = null;
long fileHeaderStart = raf.getFilePointer();
GUID guid = Utils.readGUID(raf);
if (GUID.GUID_FILE.equals(guid)) {
BigInteger chunckLen = Utils.readBig64(raf);
// Skip client GUID.
raf.skipBytes(16);
BigInteger fileSize = Utils.readBig64(raf);
if (fileSize.intValue() != raf.length()) {
System.err
.println("Filesize of file doesn't match len of Fileheader. ("
+ fileSize.toString() + ", file: "+raf.length()+")");
}
// fileTime in 100 ns since midnight of 1st january 1601 GMT
BigInteger fileTime = Utils.readBig64(raf);
BigInteger packageCount = Utils.readBig64(raf);
BigInteger timeEndPos = Utils.readBig64(raf);
BigInteger duration = Utils.readBig64(raf);
BigInteger timeStartPos = Utils.readBig64(raf);
long flags = Utils.readUINT32(raf);
long minPkgSize = Utils.readUINT32(raf);
long maxPkgSize = Utils.readUINT32(raf);
long uncompressedFrameSize = Utils.readUINT32(raf);
result = new FileHeader(fileHeaderStart, chunckLen, fileSize,
fileTime, packageCount, duration, timeStartPos, timeEndPos,
flags, minPkgSize, maxPkgSize, uncompressedFrameSize);
}
return result;
}