class FastCrc {
    /** CRC algo. */
    private static final ThreadLocal<CRC32> CRC = ThreadLocal.withInitial(CRC32::new);

    /** */
    private final CRC32 crc = new CRC32();

    /**
     * Current value.
     */
    private int val;

    /** */
    public FastCrc() {
        reset();
    }

    /**
     * Preparation for further calculations.
     */
    public void reset() {
        val = 0xffffffff;

        crc.reset();
    }

    /**
     * @return crc value.
     */
    public int getValue() {
        return val;
    }

    /**
     * @param buf Input buffer.
     * @param len Data length.
     */
    public void update(final ByteBuffer buf, final int len) {
        val = calcCrc(crc, buf, len);
    }

    /**
     * @param buf Input buffer.
     * @param len Data length.
     *
     * @return Crc checksum.
     */
    public static int calcCrc(ByteBuffer buf, int len) {
        CRC32 crcAlgo = CRC.get();

        int res = calcCrc(crcAlgo, buf, len);

        crcAlgo.reset();

        return res;
    }

    /**
     * @param file A file to calculate checksum over it.
     * @return CRC32 checksum.
     * @throws IOException If fails.
     */
    public static int calcCrc(File file) throws IOException {<FILL_FUNCTION_BODY>}

    /**
     * @param crcAlgo CRC algorithm.
     * @param buf Input buffer.
     * @param len Buffer length.
     *
     * @return Crc checksum.
     */
    private static int calcCrc(CRC32 crcAlgo, ByteBuffer buf, int len) {
        int initLimit = buf.limit();

        buf.limit(buf.position() + len);

        crcAlgo.update(buf);

        buf.limit(initLimit);

        return ~(int)crcAlgo.getValue();
    }
}

        assert !file.isDirectory() : "CRC32 can't be calculated over directories";

        CRC32 algo = new CRC32();

        try (InputStream in = new CheckedInputStream(new FileInputStream(file), algo)) {
            byte[] buf = new byte[1024];

            while (in.read(buf) != -1)
                ;
        }

        return ~(int)algo.getValue();
    
<no_super_class>