1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 24 import org.apache.poi.util.*; 25 26 31 public class GroupMarkerSubRecord 32 extends SubRecord 33 { 34 public final static short sid = 0x06; 35 36 private byte[] reserved = new byte[0]; 38 public GroupMarkerSubRecord() 39 { 40 41 } 42 43 51 52 public GroupMarkerSubRecord(short id, short size, byte [] data) 53 { 54 super(id, size, data); 55 56 } 57 58 67 68 public GroupMarkerSubRecord(short id, short size, byte [] data, int offset) 69 { 70 super(id, size, data, offset); 71 72 } 73 74 79 protected void validateSid(short id) 80 { 81 if (id != sid) 82 { 83 throw new RecordFormatException("Not a Group Marker record"); 84 } 85 } 86 87 protected void fillFields(byte [] data, short size, int offset) 88 { 89 reserved = new byte[size]; 91 System.arraycopy(data, offset, reserved, 0, size); 92 } 93 94 public String toString() 95 { 96 StringBuffer buffer = new StringBuffer (); 97 98 String nl = System.getProperty("line.separator"); 99 buffer.append("[ftGmo]" + nl); 100 buffer.append(" reserved = ").append(HexDump.toHex(reserved)).append(nl); 101 buffer.append("[/ftGmo]" + nl); 102 return buffer.toString(); 103 } 104 105 public int serialize(int offset, byte[] data) 106 { 107 LittleEndian.putShort(data, 0 + offset, sid); 108 LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); 109 System.arraycopy(reserved, 0, data, offset + 4, getRecordSize() - 4); 110 111 return getRecordSize(); 112 } 113 114 117 public int getRecordSize() 118 { 119 return 4 + reserved.length; 120 } 121 122 public short getSid() 123 { 124 return sid; 125 } 126 127 public Object clone() { 128 GroupMarkerSubRecord rec = new GroupMarkerSubRecord(); 129 rec.reserved = new byte[reserved.length]; 130 for ( int i = 0; i < reserved.length; i++ ) 131 rec.reserved[i] = reserved[i]; 132 return rec; 133 } 134 135 136 137 } 139 140 | Popular Tags |