1 2 17 18 19 20 package org.apache.poi.hwpf.model; 21 22 import org.apache.poi.util.LittleEndian; 23 24 public class SectionDescriptor 25 { 26 27 private short fn; 28 private int fc; 29 private short fnMpr; 30 private int fcMpr; 31 32 public SectionDescriptor() 33 { 34 } 35 36 public SectionDescriptor(byte[] buf, int offset) 37 { 38 fn = LittleEndian.getShort(buf, offset); 39 offset += LittleEndian.SHORT_SIZE; 40 fc = LittleEndian.getInt(buf, offset); 41 offset += LittleEndian.INT_SIZE; 42 fnMpr = LittleEndian.getShort(buf, offset); 43 offset += LittleEndian.SHORT_SIZE; 44 fcMpr = LittleEndian.getInt(buf, offset); 45 } 46 47 public int getFc() 48 { 49 return fc; 50 } 51 52 public void setFc(int fc) 53 { 54 this.fc = fc; 55 } 56 57 public boolean equals(Object o) 58 { 59 SectionDescriptor sed = (SectionDescriptor)o; 60 return sed.fn == fn && sed.fnMpr == fnMpr; 61 } 62 63 public byte[] toByteArray() 64 { 65 int offset = 0; 66 byte[] buf = new byte[12]; 67 68 LittleEndian.putShort(buf, offset, fn); 69 offset += LittleEndian.SHORT_SIZE; 70 LittleEndian.putInt(buf, offset, fc); 71 offset += LittleEndian.INT_SIZE; 72 LittleEndian.putShort(buf, offset, fnMpr); 73 offset += LittleEndian.SHORT_SIZE; 74 LittleEndian.putInt(buf, offset, fcMpr); 75 76 return buf; 77 } 78 } 79 | Popular Tags |