public static HadoopVersion getVersion ( byte [ ] historyFileContents ) { if ( historyFileContents . length > HADOOP2_VERSION_LENGTH ) { // the first 10 bytes in a hadoop2.0 history file contain Avro-Json String version2Part = new String ( historyFileContents , 0 , HADOOP2_VERSION_LENGTH ) ; if ( StringUtils . equalsIgnoreCase ( version2Part , HADOOP2_VERSION_STRING ) ) { return HadoopVersion . TWO ; } } // throw an exception if we did not find any matching version throw new IllegalArgumentException ( " Unknown format of job history file: " + historyFileContents ) ; }
determines the verison of hadoop that the history file belongs to