1 package org.jscsi.target.scsi.sense.senseDataDescriptor;
2
3
4 import java.nio.ByteBuffer;
5
6 import org.jscsi.target.scsi.sense.information.EightByteInformation;
7 import org.jscsi.target.util.BitManip;
8
9
10
11
12
13
14
15
16 public final class InformationSenseDataDescriptor extends SenseDataDescriptor {
17
18
19
20
21 private static final int VALID_FLAG_BYTE_INDEX = 2;
22
23
24
25
26 private static final int INFORMATION_INDEX = 4;
27
28
29
30
31
32
33
34
35
36 private final boolean valid = true;
37
38
39
40
41 private final EightByteInformation information;
42
43
44
45
46
47
48 public InformationSenseDataDescriptor (final EightByteInformation information) {
49 super(SenseDataDescriptorType.INFORMATION,
50 0x0a);
51 this.information = information;
52 }
53
54 @Override
55 protected final void serializeSpecificFields (final ByteBuffer byteBuffer, final int index) {
56
57 byte b = 0;
58
59
60 if (valid) b = BitManip.getByteWithBitSet(b, 7, true);
61 byteBuffer.put(index + VALID_FLAG_BYTE_INDEX, b);
62
63
64 information.serialize(byteBuffer, index + INFORMATION_INDEX);
65 }
66
67 }