Source:
public PcapOldFile(Path filePath) throws BadPcapFileException, IOException { super(filePath); ByteOrder byteOrder; 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; fTimestampPrecision = PcapTimestampScale.MICROSECOND; break; case PcapFileValues.MAGIC_LITTLE_ENDIAN_MICRO: byteOrder = ByteOrder.LITTLE_ENDIAN; fTimestampPrecision = PcapTimestampScale.MICROSECOND; break; case PcapFileValues.MAGIC_BIG_ENDIAN_NANO: byteOrder = ByteOrder.BIG_ENDIAN; fTimestampPrecision = PcapTimestampScale.NANOSECOND; break; case PcapFileValues.MAGIC_LITTLE_ENDIAN_NANO: byteOrder = ByteOrder.LITTLE_ENDIAN; fTimestampPrecision = 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()); fTimeAccuracy = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); fTimeZoneCorrection = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); fSnapshotLength = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); fDataLinkType = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); fFileIndex.put(getCurrentRank(), fFileChannel.position()); setCurrentRank(getCurrentRank()); init(byteOrder, fMajorVersion, fMinorVersion); }

Target:
public PcapOldFile(Path filePath) throws BadPcapFileException, IOException { super(filePath); ByteOrder byteOrder; TreeMap<Long, Long> fileIndex = getFileIndex(); ByteBuffer globalHeader = ByteBuffer.allocate(PcapFileValues.GLOBAL_HEADER_SIZE); getFileChannel().read(globalHeader); globalHeader.flip(); int magicNumber = globalHeader.getInt(); switch (magicNumber) { case PcapFileValues.MAGIC_BIG_ENDIAN_MICRO: byteOrder = ByteOrder.BIG_ENDIAN; fTimestampPrecision = PcapTimestampScale.MICROSECOND; break; case PcapFileValues.MAGIC_LITTLE_ENDIAN_MICRO: byteOrder = ByteOrder.LITTLE_ENDIAN; fTimestampPrecision = PcapTimestampScale.MICROSECOND; break; case PcapFileValues.MAGIC_BIG_ENDIAN_NANO: byteOrder = ByteOrder.BIG_ENDIAN; fTimestampPrecision = PcapTimestampScale.NANOSECOND; break; case PcapFileValues.MAGIC_LITTLE_ENDIAN_NANO: byteOrder = ByteOrder.LITTLE_ENDIAN; fTimestampPrecision = 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()); fTimeAccuracy = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); fTimeZoneCorrection = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); fSnapshotLength = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); fDataLinkType = ConversionHelper.unsignedIntToLong(globalHeader.getInt()); fileIndex.put(getCurrentRank(), getFileChannel().position()); init(byteOrder, fMajorVersion, fMinorVersion); }