Class ScsiBlockDevice

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getBlockSize()
      Returns the block size of the block device.
      void init()
      Issues a SCSI Inquiry to determine the connected device.
      void read​(long devOffset, java.nio.ByteBuffer dest)
      This method reads from the device at the specific device offset.
      void write​(long devOffset, java.nio.ByteBuffer src)
      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
    • Constructor Detail

      • ScsiBlockDevice

        public ScsiBlockDevice​(UsbCommunication usbCommunication)
    • Method Detail

      • read

        public void read​(long devOffset,
                         java.nio.ByteBuffer dest)
                  throws java.io.IOException
        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!
        Specified by:
        read in interface BlockDeviceDriver
        Parameters:
        devOffset - The offset where the reading should begin.
        dest - The buffer where the data should be read into.
        Throws:
        java.io.IOException - If reading fails.
      • write

        public void write​(long devOffset,
                          java.nio.ByteBuffer src)
                   throws java.io.IOException
        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!
        Specified by:
        write in interface BlockDeviceDriver
        Parameters:
        devOffset - The offset where the writing should begin.
        src - The buffer with the data to be transferred.
        Throws:
        java.io.IOException - If writing fails.
      • getBlockSize

        public int getBlockSize()
        Description copied from interface: BlockDeviceDriver
        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 hole blocks!

        Specified by:
        getBlockSize in interface BlockDeviceDriver
        Returns:
        The block size in bytes, mostly 512 bytes.