當前位置: 首頁>>代碼示例>>C#>>正文


C# POIFSBigBlockSize.GetBigBlockSize方法代碼示例

本文整理匯總了C#中NPOI.POIFS.Common.POIFSBigBlockSize.GetBigBlockSize方法的典型用法代碼示例。如果您正苦於以下問題:C# POIFSBigBlockSize.GetBigBlockSize方法的具體用法?C# POIFSBigBlockSize.GetBigBlockSize怎麽用?C# POIFSBigBlockSize.GetBigBlockSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NPOI.POIFS.Common.POIFSBigBlockSize的用法示例。


在下文中一共展示了POIFSBigBlockSize.GetBigBlockSize方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: BuildProperties

        private static List<Property> BuildProperties(IEnumerator<ByteBuffer> dataSource, POIFSBigBlockSize bigBlockSize)
        {
            List<Property> properties = new List<Property>();

            while(dataSource.MoveNext())
            {
                ByteBuffer bb = dataSource.Current;

                // Turn it into an array
                byte[] data;
                if (bb.HasBuffer && bb.Offset == 0 &&
                    bb.Buffer.Length == bigBlockSize.GetBigBlockSize())
                {
                    data = bb.Buffer;
                }
                else
                {
                    data = new byte[bigBlockSize.GetBigBlockSize()];
                    int toRead = data.Length;
                    if (bb.Remaining() < bigBlockSize.GetBigBlockSize())
                    {
                        // Looks to be a truncated block
                        // This isn't allowed, but some third party created files
                        //  sometimes do this, and we can normally read anyway

                        toRead = bb.Remaining();
                    }
                    bb.Read(data, 0, toRead);
                }

                PropertyFactory.ConvertToProperties(data, properties);
            }
            return properties;

        }
開發者ID:Reinakumiko,項目名稱:npoi,代碼行數:35,代碼來源:NPropertyTable.cs

示例2: BuildProperties

//        private static List<Property> BuildProperties(IEnumerator<byte[]> dataSource, POIFSBigBlockSize bigBlockSize)
        private static List<Property> BuildProperties(IEnumerator<ByteBuffer> dataSource, POIFSBigBlockSize bigBlockSize)
        {
            try
            {
                List<Property> properties = new List<Property>();

                while(dataSource.MoveNext())
                {
                    ByteBuffer bb = dataSource.Current;
                    //byte[] bb = (byte[])dataSource.Current;

                    // Turn it into an array
                    byte[] data;
                    if (bb.HasBuffer && bb.Offset == 0 &&
                        bb.Buffer.Length == bigBlockSize.GetBigBlockSize())
                    {
                        data = bb.Buffer;
                    }
                    else
                    {
                        data = new byte[bigBlockSize.GetBigBlockSize()];
                        //bb.get(data, 0, data.length);
                        bb.Read(data, 0, data.Length);
                    }
                    //}

                    //data = new byte[bigBlockSize.GetBigBlockSize()];
                    //System.Array.Copy(bb, data, bb.Length);

                    PropertyFactory.ConvertToProperties(data, properties);
                }
                return properties;

            }
            catch(System.IO.IOException ex)
            {
                throw ex;
            }

         
        }
開發者ID:xoposhiy,項目名稱:npoi,代碼行數:42,代碼來源:NPropertyTable.cs

示例3: RawDataBlockList

        /// <summary>
        /// Initializes a new instance of the <see cref="RawDataBlockList"/> class.
        /// </summary>
        /// <param name="stream">the InputStream from which the data will be read</param>
        /// <param name="bigBlockSize">The big block size, either 512 bytes or 4096 bytes</param>
        public RawDataBlockList(Stream stream, POIFSBigBlockSize bigBlockSize)
        {
            List<RawDataBlock> blocks = new List<RawDataBlock>();

            while (true)
            {
                RawDataBlock block = new RawDataBlock(stream, bigBlockSize.GetBigBlockSize());
                
                // If there was data, add the block to the list
                if(block.HasData) {
            	    blocks.Add(block);
                }

                // If the stream is now at the End Of File, we're done
                if (block.EOF) {
                    break;
                }
            }
             SetBlocks((ListManagedBlock[])blocks.ToArray());
        }
開發者ID:xoposhiy,項目名稱:npoi,代碼行數:25,代碼來源:RawDataBlockList.cs

示例4: CalculateMaximumSize

        /**
         * Calculates the maximum size of a file which is addressable given the
         *  number of FAT (BAT) sectors specified. (We don't care if those BAT
         *  blocks come from the 109 in the header, or from header + XBATS, it
         *  won't affect the calculation)
         *  
         * The actual file size will be between [size of fatCount-1 blocks] and
         *   [size of fatCount blocks].
         *  For 512 byte block sizes, this means we may over-estimate by up to 65kb.
         *  For 4096 byte block sizes, this means we may over-estimate by up to 4mb
         */
        public static int CalculateMaximumSize(POIFSBigBlockSize bigBlockSize,
              int numBATs)
        {
            int size = 1; // Header isn't FAT addressed

            // The header has up to 109 BATs, and extra ones are referenced
            //  from XBATs
            // However, all BATs can contain 128/1024 blocks
            size += (numBATs * bigBlockSize.GetBATEntriesPerBlock());

            // So far we've been in sector counts, turn into bytes
            return size * bigBlockSize.GetBigBlockSize();
        }
開發者ID:xoposhiy,項目名稱:npoi,代碼行數:24,代碼來源:BATBlock.cs

示例5: GetBlocksPerBigBlock

 private static int GetBlocksPerBigBlock(POIFSBigBlockSize bigBlockSize)
 {
     return bigBlockSize.GetBigBlockSize()/_block_size;
 }
開發者ID:89sos98,項目名稱:npoi,代碼行數:4,代碼來源:SmallDocumentBlock.cs


注:本文中的NPOI.POIFS.Common.POIFSBigBlockSize.GetBigBlockSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。