Coverage Report - org.jscsi.target.scsi.lun.LogicalUnitNumber
 
Classes in this File Line Coverage Branch Coverage Complexity
LogicalUnitNumber
0%
0/9
0%
0/2
1.25
 
 1  
 package org.jscsi.target.scsi.lun;
 2  
 
 3  
 
 4  
 import java.nio.ByteBuffer;
 5  
 
 6  
 import org.jscsi.target.scsi.ISerializable;
 7  
 import org.jscsi.target.util.ReadWrite;
 8  
 
 9  
 
 10  
 /**
 11  
  * A 64-bit identifier for a logical unit.
 12  
  * 
 13  
  * @author Andreas Ergenzinger
 14  
  */
 15  
 public class LogicalUnitNumber implements ISerializable {
 16  
 
 17  
     /**
 18  
      * Length of the field in bytes.
 19  
      */
 20  
     public static final int SIZE = 8;
 21  
 
 22  
     /**
 23  
      * Byte representation of the object.
 24  
      */
 25  
     private final byte[] bytes;
 26  
 
 27  0
     public LogicalUnitNumber (final long logicalUnitNumber) {
 28  0
         bytes = ReadWrite.longToBytes(logicalUnitNumber);
 29  0
     }
 30  
 
 31  
     public void serialize (ByteBuffer byteBuffer, int index) {
 32  0
         byteBuffer.position(index);
 33  0
         for (int i = 0; i < bytes.length; ++i)
 34  0
             byteBuffer.put(bytes[i]);
 35  0
     }
 36  
 
 37  
     public int size () {
 38  0
         return SIZE;
 39  
     }
 40  
 
 41  
     @Override
 42  
     public String toString () {
 43  0
         return java.util.Arrays.toString(bytes);
 44  
     }
 45  
 }