Source:
public PcapOldFile(Path filePath) throws BadPcapFileException, IOException { super(filePath); ByteOrder byteOrder; PcapTimestampScale timestampPrecision; TreeMap<Long, Long> fFileIndex = getFileIndex(); currentRank = 0; SeekableByteChannel fFileChannel = getFileChannel(); ByteBuffer globalHeader = ByteBuffer.allocate(PcapFileValues.GLOBAL_HEADER_SIZE); globalHeader.clear(); fFileChannel.read(globalHeader); globalHeader.flip(); int magicNumber = globalHeader.getInt(); switch (magicNumber) { case PcapFileValues.MAGIC_BIG_ENDIAN_MICRO: byteOrder = ByteOrder.BIG_ENDIAN; timestampPrecision = PcapTimestampScale.MICROSECOND; break; case PcapFileValues.MAGIC_LITTLE_ENDIAN_MICRO: byteOrder = ByteOrder.LITTLE_ENDIAN; timestampPrecision = PcapTimestampScale.MICROSECOND; break; case PcapFileValues.MAGIC_BIG_ENDIAN_NANO: byteOrder = ByteOrder.BIG_ENDIAN; timestampPrecision = PcapTimestampScale.NANOSECOND; break; case PcapFileValues.MAGIC_LITTLE_ENDIAN_NANO: byteOrder = ByteOrder.LITTLE_ENDIAN; timestampPrecision = PcapTimestampScale.NANOSECOND; break; default: this.close(); throw new BadPcapFileException(String.format("%08x", magicNumber) + " is not a known magic number."); } globalHeader.order(byteOrder); int fMajorVersion = ConversionHelper.unsignedShortToInt(globalHeader.getShort()); int fMinorVersion = ConversionHelper.unsignedShortToInt(globalHeader.getShort()); long fTimeAccuracy = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); long fTimeZoneCorrection = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); long fSnapshotLength = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); long fDataLinkType = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); fFileIndex.put(currentRank, fFileChannel.position()); setCurrentRank(currentRank); init(byteOrder, fMajorVersion, fMinorVersion, fTimeAccuracy, fTimeZoneCorrection, fSnapshotLength, fDataLinkType, timestampPrecision); }

Target:
public PcapOldFile(Path filePath) throws BadPcapFileException, IOException { super(filePath); ByteOrder byteOrder; PcapTimestampScale timestampPrecision; TreeMap<Long, Long> fFileIndex = getFileIndex(); setCurrentRank(0); SeekableByteChannel fFileChannel = getFileChannel(); ByteBuffer globalHeader = ByteBuffer.allocate(PcapFileValues.GLOBAL_HEADER_SIZE); globalHeader.clear(); fFileChannel.read(globalHeader); globalHeader.flip(); int magicNumber = globalHeader.getInt(); switch (magicNumber) { case PcapFileValues.MAGIC_BIG_ENDIAN_MICRO: byteOrder = ByteOrder.BIG_ENDIAN; timestampPrecision = PcapTimestampScale.MICROSECOND; break; case PcapFileValues.MAGIC_LITTLE_ENDIAN_MICRO: byteOrder = ByteOrder.LITTLE_ENDIAN; timestampPrecision = PcapTimestampScale.MICROSECOND; break; case PcapFileValues.MAGIC_BIG_ENDIAN_NANO: byteOrder = ByteOrder.BIG_ENDIAN; timestampPrecision = PcapTimestampScale.NANOSECOND; break; case PcapFileValues.MAGIC_LITTLE_ENDIAN_NANO: byteOrder = ByteOrder.LITTLE_ENDIAN; timestampPrecision = PcapTimestampScale.NANOSECOND; break; default: this.close(); throw new BadPcapFileException(String.format("%08x", magicNumber) + " is not a known magic number."); } globalHeader.order(byteOrder); int fMajorVersion = ConversionHelper.unsignedShortToInt(globalHeader.getShort()); int fMinorVersion = ConversionHelper.unsignedShortToInt(globalHeader.getShort()); long fTimeAccuracy = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); long fTimeZoneCorrection = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); long fSnapshotLength = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); long fDataLinkType = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); fFileIndex.put(getCurrentRank(), fFileChannel.position()); setCurrentRank(getCurrentRank()); init(byteOrder, fMajorVersion, fMinorVersion, fTimeAccuracy, fTimeZoneCorrection, fSnapshotLength, fDataLinkType, timestampPrecision); }