CPD Results

The following document contains the results of PMD's CPD 4.3.

Duplications

FileLine
org/jscsi/target/scsi/cdb/Read6Cdb.java28
org/jscsi/target/scsi/cdb/Write6Cdb.java26
    public Read6Cdb (ByteBuffer buffer) {
        super(buffer);
    }

    @Override
    protected long deserializeLogicalBlockAddress (ByteBuffer buffer) {
        // the first three bits of byte 1 are reserved i.e. must be 0
        // check that
        final byte b = buffer.get(1);
        if (((b >> 5) & 7) != 0) addIllegalFieldPointer(1);

        // read the field's value
        return ((b & 31) << 16) | ReadWrite.readTwoByteInt(buffer, 2);
    }

    @Override
    protected int deserializeTransferLength (ByteBuffer buffer) {
        /*
         * A TRANSFER LENGTH field set to zero specifies that 256 logical blocks shall be read. Any other value
         * specifies the number of logical blocks that shall be read.
         */
        final int value = ReadWrite.readOneByteInt(buffer, 4);
        if (value == 0) return 256;
        return value;
    }

    @Override
    protected int getLogicalBlockAddressFieldIndex () {
        return 1;
    }

    @Override
    protected int getTransferLengthFieldIndex () {
        return 4;
    }

}