private long checkFileHeader(BufferedFileDataInput bfdi) throws ReplicatorException, InterruptedException {
  int magic=0;
  short major=0;
  short minor=0;
  try {
    bfdi.waitAvailable(HEADER_LENGTH,HEADER_WAIT_MILLIS);
    magic=bfdi.readInt();
    major=bfdi.readShort();
    minor=bfdi.readShort();
    baseSeqno=bfdi.readLong();
  }
 catch (  IOException e) {
    throw new THLException("Failed to read file header from  " + file.getAbsolutePath(),e);
  }
  if (magic != MAGIC_NUMBER)   throw new THLException("Could not open file " + file.getAbsolutePath() + " : invalid magic number");
  if (major != MAJOR_VERSION)   throw new THLException("Could not open file " + file.getAbsolutePath() + " : incompatible major version");
  if (minor != MINOR_VERSION)   logger.warn("Minor version mismatch : file " + file.getAbsolutePath() + " using format "+ major+ "."+ minor+ " - Tungsten running version "+ MAJOR_VERSION+ "."+ MINOR_VERSION);
  return baseSeqno;
}

private long checkFileHeader ( BufferedFileDataInput bfdi ) throws ReplicatorException , InterruptedException { int magic = 0 ; short major = 0 ; short minor = 0 ; try { bfdi . waitAvailable ( HEADER_LENGTH , HEADER_WAIT_MILLIS ) ; magic = bfdi . readInt ( ) ; major = bfdi . readShort ( ) ; minor = bfdi . readShort ( ) ; baseSeqno = bfdi . readLong ( ) ; } catch ( IOException e ) { throw new THLException ( "Failed to read file header from  " + file . getAbsolutePath ( ) , e ) ; } if ( magic != MAGIC_NUMBER ) throw new THLException ( "Could not open file " + file . getAbsolutePath ( ) + " : invalid magic number" ) ; if ( major != MAJOR_VERSION ) throw new THLException ( "Could not open file " + file . getAbsolutePath ( ) + " : incompatible major version" ) ; if ( minor != MINOR_VERSION ) logger . warn ( "Minor version mismatch : file " + file . getAbsolutePath ( ) + " using format " + major + "." + minor + " - Tungsten running version " + MAJOR_VERSION + "." + MINOR_VERSION ) ; return baseSeqno ; }
read the file header and return the log sequence number stored in the file header .
