Package org.jscsi.scsi.protocol.util

Examples of org.jscsi.scsi.protocol.util.ByteBufferInputStream


   }
  

   public void decode(byte[] header, ByteBuffer input) throws IOException
   {
      DataInputStream in = new DataInputStream(new ByteBufferInputStream(input));

      int operationCode = in.readUnsignedByte();
      if (operationCode != OPERATION_CODE)
      {
         throw new IOException("Invalid operation code: " + Integer.toHexString(operationCode));
View Full Code Here


public class SenseDataFactory implements Serializer
{
   @SuppressWarnings("unchecked")
   public SenseData decode(ByteBuffer buffer) throws IOException
   {
      DataInputStream in = new DataInputStream(new ByteBufferInputStream(buffer));

      int b1 = in.readUnsignedByte();
      ResponseCode code = ResponseCode.valueOf((byte) (b1 & 0x7F)); // throws IOException

      SenseData sense = null;
View Full Code Here

      this(dbd, pageControl, pageCode, subPageCode, false, false, allocationLength);
   }

   public void decode(byte[] header, ByteBuffer input) throws IOException
   {
      DataInputStream in = new DataInputStream(new ByteBufferInputStream(input));
      int tmp;

      int operationCode = in.readUnsignedByte();
      this.DBD = (in.readUnsignedByte() & 0x08) != 0;
      tmp = in.readUnsignedByte();
View Full Code Here

   {
      assert header != null && header.length == 1 : "input header is invalid";
      boolean valid = (header[0] & 0x80) != 0;
      this.setResponseCode(ResponseCode.valueOf((byte) (header[0] & 0x7F)));

      DataInputStream in = new DataInputStream(new ByteBufferInputStream(input));

      // read in first segment of fixed format sense data
      in.readByte();
      int key = in.readUnsignedByte() & 0x0F; // TODO: FILEMARK, EOM, and ILI are unsupported
      byte[] info = new byte[4];
View Full Code Here

   /////////////////////////////////////////////////////////////////////////////
   // constructors

   public void decode(byte[] header, ByteBuffer buffer) throws IOException
   {
      DataInputStream in = new DataInputStream(new ByteBufferInputStream(buffer));

      // byte 0
      int b0 = in.readUnsignedByte();
      this.setPeripheralQualifier(b0 >>> 5);
      this.setPeripheralDeviceType(b0 & 0x1F);
View Full Code Here

      this(false, false, logicalBlockAddress, transferLength);
   }

   public void decode(byte[] header, ByteBuffer input) throws IOException
   {
      DataInputStream in = new DataInputStream(new ByteBufferInputStream(input));

      int operationCode = in.readUnsignedByte();

      long msb = in.readUnsignedByte() & 0x1F;
      long lss = in.readUnsignedShort();
View Full Code Here

      this(evpd, pageCode, false, false, allocationLength);
   }

   public void decode(byte[] header, ByteBuffer input) throws IOException
   {
      DataInputStream in = new DataInputStream(new ByteBufferInputStream(input));

      int operationCode = in.readUnsignedByte();
      this.EVPD = (in.readUnsignedByte() & 0x01) == 0x01;
      this.pageCode = in.readUnsignedByte();
      setAllocationLength(in.readUnsignedShort());
View Full Code Here

      this(false, false, allocationLength);
   }

   public void decode(byte[] header, ByteBuffer input) throws IOException
   {
      DataInputStream in = new DataInputStream(new ByteBufferInputStream(input));

      int operationCode = in.readUnsignedByte();
      int serviceAction = in.readUnsignedByte() & 0x1F;
      in.readInt();
      long mss = in.readUnsignedShort();
View Full Code Here

         this.subPageCode = 0;
         pageLength = header[1];
         dataLength = pageLength - 2;
      }

      DataInputStream dataIn = new DataInputStream(new ByteBufferInputStream(buffer));
      decodeModeParameters(dataLength, dataIn);
   }
View Full Code Here

         throw new ModeSenseException("ModeSenseTask returned null");
      }

      try
      {
         DataInputStream in = new DataInputStream(new ByteBufferInputStream(data));

         int modeDataLength = in.readUnsignedByte();
         int mediumType = in.readUnsignedByte();
         in.readUnsignedByte(); // skip DEVICE-SPECIFIC PARAMETER
         int blockDescriptorLength = in.readUnsignedByte();
View Full Code Here

TOP

Related Classes of org.jscsi.scsi.protocol.util.ByteBufferInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.