Package com.extentech.formats.LEO

Examples of com.extentech.formats.LEO.Storage


  HashMap<Integer, Storage> caches= new HashMap();
  HashMap<Integer, ArrayList<BiffRec>> pivotCacheRecs= new HashMap();
//  HashMap<String, ArrayList> caches= new HashMap();
 
  public void init(StorageTable directories, WorkBookHandle wbh) throws StorageNotFoundException {
    Storage child= directories.getChild("_SX_DB_CUR");
    if (wbh!=null)  {
      caches= new HashMap();
      book= wbh.getWorkBook();   
      if (wbh.getDebugLevel() > 25) {    // KSC: TESTING: make > 25
        Logger.logInfo("PivotCache.init");
      }
    }
   
    while (child!=null) {
      if (wbh!=null)
      caches.put(Integer.valueOf(child.getName()), child);
      ArrayList<BiffRec> curRecs= new ArrayList();
      BlockByteReader bytes= child.getBlockReader();
      int len= bytes.getLength();
      for (int i = 0; i <= len - 4;) {
        byte[] headerbytes = bytes.getHeaderBytes(i);
        short opcode = ByteTools.readShort(headerbytes[0], headerbytes[1]);
        int reclen = ByteTools.readShort(headerbytes[2], headerbytes[3]);
        BiffRec rec = XLSRecordFactory.getBiffRecord( opcode );
        if (wbh!=null) rec.setDebugLevel(wbh.getDebugLevel()); // KSC: added to propogate debug level
       
        // init the mighty rec
        rec.setWorkBook(book);
        rec.setByteReader(bytes);
        rec.setLength((short) reclen);
        rec.setOffset(i);
        rec.init();
/*       
// KSC: TESTING       
    try {
System.out.println(rec.getClass().getName().substring(rec.getClass().getName().lastIndexOf(".")+1) + ": " + Arrays.toString(((PivotCacheRecord)rec).getRecord()));       
    } catch (ClassCastException e) {
System.out.println(rec.getClass().getName().substring(rec.getClass().getName().lastIndexOf(".")+1) + ": " + Arrays.toString(ByteTools.shortToLEBytes(rec.getOpcode())) + Arrays.toString(ByteTools.shortToLEBytes((short)rec.getData().length)) + Arrays.toString(rec.getData()));       
    }
*/   
        if (wbh!=null)
          curRecs.add(rec);
       
        i+=reclen+4;
      }
      if (wbh!=null)             
      pivotCacheRecs.put(Integer.valueOf(child.getName()), curRecs);
      child= directories.getNext(child.getName());
    }
// KSC: TESTING   
//    Logger.logInfo("PivotCache.end init");
  }
View Full Code Here


       */
      // KSC: unsure if it's absolutely necessary to also have CompObj storage
      try {     
        directories.getDirectoryByName("\1CompObj");
      } catch (StorageNotFoundException e) {
        Storage compObj= directories.createStorage("\1CompObj", 2, directories.getDirectoryStreamID("\005DocumentSummaryInformation")+1);
        compObj.setBytesWithOverage(new byte[] {1, 0, -2, -1, 3, 10, 0, 0, -1, -1, -1, -1, 32, 8, 2, 0, 0, 0, 0, 0, -64, 0, 0, 0, 0, 0, 0, 70, 38, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 79, 102, 102, 105, 99, 101, 32, 69, 120, 99, 101, 108, 32, 50, 48, 48, 51, 32, 87, 111, 114, 107, 115, 104, 101, 101, 116, 0, 6, 0, 0, 0, 66, 105, 102, 102, 56, 0, 14, 0, 0, 0, 69, 120, 99, 101, 108, 46, 83, 104, 101, 101, 116, 46, 56, 0, -12, 57, -78, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
        int compObjid= directories.getDirectoryStreamID("\1CompObj");
        Storage wb= directories.getDirectoryByName("Workbook");
        wb.setPrevStorageID(compObjid);
      }

       /* create _SX_DB_CUR + child (actual pivot cache) directory and put in proper order in directory array */
      Storage sx_db_cur= directories.createStorage("_SX_DB_CUR", 1, directories.getDirectoryStreamID("\005SummaryInformation"))// Pivot Cache Storage:  (id= 1) insert just before SummaryInfo -- ALWAYS ??????
      int sxdbcurid= directories.getDirectoryStreamID("_SX_DB_CUR")//
      Storage pcache1= directories.createStorage("0001", 2, sxdbcurid + 1);      // TODO: handle multiple Caches ... 0002 ...
      directories.getDirectoryByName("Root Entry").setChildStorageID(sxdbcurid);
      sx_db_cur.setPrevStorageID(directories.getDirectoryStreamID("Workbook"));
      sx_db_cur.setChildStorageID(directories.getDirectoryStreamID("0001"));      // child= 0001 Cache Stream (id= 2)
      sx_db_cur.setNextStorageID(directories.getDirectoryStreamID("\005SummaryInformation"));
      Storage si= directories.getDirectoryByName("\005SummaryInformation");
      si.setPrevStorageID(-1)// Necessary?????????
      si.setNextStorageID(directories.getDirectoryStreamID("\005DocumentSummaryInformation"));
      directories.getDirectoryByName("Root Entry").setChildStorageID(sxdbcurid);    // ??? ALWAYS ????
     
      // create pivot cache records which are source of actual pivot cache data
      byte[] newbytes= createPivotCacheRecords(ref, wbh, sId)
      pcache1.setBytesWithOverage(newbytes);
View Full Code Here

        newbytes= ByteTools.append(ByteTools.shortToLEBytes((short)br.getData().length), newbytes);
        newbytes= ByteTools.append(br.getData(), newbytes);
//System.out.println(br.getClass().getName().substring(br.getClass().getName().lastIndexOf(".")+1) + ": " + Arrays.toString(ByteTools.shortToLEBytes(br.getOpcode())) + Arrays.toString(ByteTools.shortToLEBytes((short)br.getData().length)) + Arrays.toString(br.getData()));       
      }
    }
    Storage pcache1= caches.get(cacheId+1);
    pcache1.setBytesWithOverage(newbytes);
// KSC: TESTING   
/*    try {
    this.init(book.factory.myLEO.getDirectoryArray(), null);
    } catch (StorageNotFoundException e) {     
    }*/
 
View Full Code Here

TOP

Related Classes of com.extentech.formats.LEO.Storage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.