Package 

Class ScsiBlockDevice

  • All Implemented Interfaces:
    com.github.mjdev.libaums.driver.BlockDeviceDriver

    
    public final class ScsiBlockDevice
     implements BlockDeviceDriver
                        

    This class is responsible for handling mass storage devices which follow the SCSI standard. This class communicates with the mass storage device via the different SCSI commands.

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Integer getBlockSize() Returns the block size of the block device.
      Unit setBlockSize(Integer blockSize)
      Long getBlocks() The size of the block device, in blocks of blockSize bytes,
      Unit init() Issues a SCSI Inquiry to determine the connected device.
      Unit read(Long deviceOffset, ByteBuffer buffer) This method reads from the device at the specific device offset.
      Unit write(Long deviceOffset, ByteBuffer buffer) This method writes from the device at the specific device offset.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getBlockSize

         Integer getBlockSize()

        Returns the block size of the block device. Every block device can only read and store bytes in a specific block with a certain size.

        That means that it is only possible to read or write whole blocks!

      • init

         Unit init()

        Issues a SCSI Inquiry to determine the connected device. After that it is checked if the unit is ready. Logs a warning if the unit is not ready. Finally the capacity of the mass storage device is read.

      • read

        @Synchronized() Unit read(Long deviceOffset, ByteBuffer buffer)

        This method reads from the device at the specific device offset. The devOffset specifies at which block the reading should begin. That means the devOffset is not in bytes!

        Parameters:
        deviceOffset - The offset where the reading should begin.
        buffer - The buffer where the data should be read into.
      • write

        @Synchronized() Unit write(Long deviceOffset, ByteBuffer buffer)

        This method writes from the device at the specific device offset. The devOffset specifies at which block the writing should begin. That means the devOffset is not in bytes!

        Parameters:
        deviceOffset - The offset where the writing should begin.
        buffer - The buffer with the data to be transferred.