FileDocCategorySizeDatePackage
FIBFieldHandler.javaAPI DocApache Poi 3.0.18204Mon Jan 01 18:55:32 GMT 2007org.apache.poi.hwpf.model

FIBFieldHandler

public class FIBFieldHandler extends Object

Fields Summary
public static final int
STSHFORIG
public static final int
STSHF
public static final int
PLCFFNDREF
public static final int
PLCFFNDTXT
public static final int
PLCFANDREF
public static final int
PLCFANDTXT
public static final int
PLCFSED
public static final int
PLCFPAD
public static final int
PLCFPHE
public static final int
STTBGLSY
public static final int
PLCFGLSY
public static final int
PLCFHDD
public static final int
PLCFBTECHPX
public static final int
PLCFBTEPAPX
public static final int
PLCFSEA
public static final int
STTBFFFN
public static final int
PLCFFLDMOM
public static final int
PLCFFLDHDR
public static final int
PLCFFLDFTN
public static final int
PLCFFLDATN
public static final int
PLCFFLDMCR
public static final int
STTBFBKMK
public static final int
PLCFBKF
public static final int
PLCFBKL
public static final int
CMDS
public static final int
PLCMCR
public static final int
STTBFMCR
public static final int
PRDRVR
public static final int
PRENVPORT
public static final int
PRENVLAND
public static final int
WSS
public static final int
DOP
public static final int
STTBFASSOC
public static final int
CLX
public static final int
PLCFPGDFTN
public static final int
AUTOSAVESOURCE
public static final int
GRPXSTATNOWNERS
public static final int
STTBFATNBKMK
public static final int
PLCFDOAMOM
public static final int
PLCDOAHDR
public static final int
PLCSPAMOM
public static final int
PLCSPAHDR
public static final int
PLCFATNBKF
public static final int
PLCFATNBKL
public static final int
PMS
public static final int
FORMFLDSTTBS
public static final int
PLCFENDREF
public static final int
PLCFENDTXT
public static final int
PLCFFLDEDN
public static final int
PLCFPGDEDN
public static final int
DGGINFO
public static final int
STTBFRMARK
public static final int
STTBCAPTION
public static final int
STTBAUTOCAPTION
public static final int
PLCFWKB
public static final int
PLCFSPL
public static final int
PLCFTXBXTXT
public static final int
PLCFFLDTXBX
public static final int
PLCFHDRTXBXTXT
public static final int
PLCFFLDHDRTXBX
public static final int
STWUSER
public static final int
STTBTTMBD
public static final int
UNUSED
public static final int
PGDMOTHER
public static final int
BKDMOTHER
public static final int
PGDFTN
public static final int
BKDFTN
public static final int
PGDEDN
public static final int
BKDEDN
public static final int
STTBFINTFLD
public static final int
ROUTESLIP
public static final int
STTBSAVEDBY
public static final int
STTBFNM
public static final int
PLCFLST
public static final int
PLFLFO
public static final int
PLCFTXBXBKD
public static final int
PLCFTXBXHDRBKD
public static final int
DOCUNDO
public static final int
RGBUSE
public static final int
USP
public static final int
USKF
public static final int
PLCUPCRGBUSE
public static final int
PLCUPCUSP
public static final int
STTBGLSYSTYLE
public static final int
PLGOSL
public static final int
PLCOCX
public static final int
PLCFBTELVC
public static final int
MODIFIED
public static final int
PLCFLVC
public static final int
PLCASUMY
public static final int
PLCFGRAM
public static final int
STTBLISTNAMES
public static final int
STTBFUSSR
private static POILogger
log
private static final int
FIELD_SIZE
private HashMap
_unknownMap
private int[]
_fields
Constructors Summary
public FIBFieldHandler(byte[] mainStream, int offset, byte[] tableStream, HashSet offsetList, boolean areKnown)



        
                            
  
    int numFields = LittleEndian.getShort(mainStream, offset);
    offset += LittleEndian.SHORT_SIZE;
    _fields = new int[numFields * 2];

    for (int x = 0; x < numFields; x++)
    {
      int fieldOffset = (x * FIELD_SIZE) + offset;
      int dsOffset = LittleEndian.getInt(mainStream, fieldOffset);
      fieldOffset += LittleEndian.INT_SIZE;
      int dsSize = LittleEndian.getInt(mainStream, fieldOffset);

      if (offsetList.contains(new Integer(x)) ^ areKnown)
      {
        if (dsSize > 0)
        {
          if (dsOffset + dsSize > tableStream.length)
          {
            log.log(POILogger.WARN, "Unhandled data structure points to outside the buffer. " +
                                    "offset = " + dsOffset + ", length = " + dsSize +
                                    ", buffer length = " + tableStream.length);
          }
          else
          {
            UnhandledDataStructure unhandled = new UnhandledDataStructure(
              tableStream, dsOffset, dsSize);
            _unknownMap.put(new Integer(x), unhandled);
          }
        }
      }
      _fields[x*2] = dsOffset;
      _fields[(x*2) + 1] = dsSize;
    }
  
Methods Summary
public voidclearFields()

    Arrays.fill(_fields, 0);
  
public intgetFieldOffset(int field)

    return _fields[field*2];
  
public intgetFieldSize(int field)

    return _fields[(field*2) + 1];
  
public voidsetFieldOffset(int field, int offset)

    _fields[field*2] = offset;
  
public voidsetFieldSize(int field, int size)

    _fields[(field*2) + 1] = size;
  
public intsizeInBytes()

    return (_fields.length * LittleEndian.INT_SIZE) + LittleEndian.SHORT_SIZE;
  
voidwriteTo(byte[] mainStream, int offset, org.apache.poi.hwpf.model.io.HWPFOutputStream tableStream)

    int length = _fields.length/2;
    LittleEndian.putShort(mainStream, offset, (short)length);
    offset += LittleEndian.SHORT_SIZE;

    for (int x = 0; x < length; x++)
    {
      UnhandledDataStructure ds = (UnhandledDataStructure)_unknownMap.get(new Integer(x));
      if (ds != null)
      {
        LittleEndian.putInt(mainStream, offset, tableStream.getOffset());
        offset += LittleEndian.INT_SIZE;
        byte[] buf = ds.getBuf();
        tableStream.write(buf);
        LittleEndian.putInt(mainStream, offset, buf.length);
        offset += LittleEndian.INT_SIZE;
      }
      else
      {
        LittleEndian.putInt(mainStream, offset, _fields[x * 2]);
        offset += LittleEndian.INT_SIZE;
        LittleEndian.putInt(mainStream, offset, _fields[(x * 2) + 1]);
        offset += LittleEndian.INT_SIZE;
      }
    }