1 2 17 18 package org.apache.poi.hwpf.model; 19 20 import java.io.IOException ; 21 22 import org.apache.poi.util.LittleEndian; 23 24 public class FIBLongHandler 25 { 26 public static final int CBMAC = 0; 27 public static final int PRODUCTCREATED = 1; 28 public static final int PRODUCTREVISED = 2; 29 public static final int CCPTEXT = 3; 30 public static final int CCPFTN = 4; 31 public static final int CCPHDD = 5; 32 public static final int CCPMCR = 6; 33 public static final int CCPATN = 7; 34 public static final int CCPEDN = 8; 35 public static final int CCPTXBX = 9; 36 public static final int CCPHDRTXBX = 10; 37 public static final int PNFBPCHPFIRST = 11; 38 public static final int PNCHPFIRST = 12; 39 public static final int CPNBTECHP = 13; 40 public static final int PNFBPPAPFIRST = 14; 41 public static final int PNPAPFIRST = 15; 42 public static final int CPNBTEPAP = 16; 43 public static final int PNFBPLVCFIRST = 17; 44 public static final int PNLVCFIRST = 18; 45 public static final int CPNBTELVC = 19; 46 public static final int FCISLANDFIRST = 20; 47 public static final int FCISLANDLIM = 21; 48 49 int[] _longs; 50 51 public FIBLongHandler(byte[] mainStream, int offset) 52 { 53 int longCount = LittleEndian.getShort(mainStream, offset); 54 offset += LittleEndian.SHORT_SIZE; 55 _longs = new int[longCount]; 56 57 for (int x = 0; x < longCount; x++) 58 { 59 _longs[x] = LittleEndian.getInt(mainStream, offset + (x * LittleEndian.INT_SIZE)); 60 } 61 } 62 63 68 public int getLong(int longCode) 69 { 70 return _longs[longCode]; 71 } 72 73 public void setLong(int longCode, int value) 74 { 75 _longs[longCode] = value; 76 } 77 78 void serialize(byte[] mainStream, int offset) 79 throws IOException 80 { 81 LittleEndian.putShort(mainStream, offset, (short)_longs.length); 82 offset += LittleEndian.SHORT_SIZE; 83 84 for (int x = 0; x < _longs.length; x++) 85 { 86 LittleEndian.putInt(mainStream, offset, _longs[x]); 87 offset += LittleEndian.INT_SIZE; 88 } 89 } 90 91 int sizeInBytes() 92 { 93 return (_longs.length * LittleEndian.INT_SIZE) + LittleEndian.SHORT_SIZE; 94 } 95 96 97 } 98 | Popular Tags |