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


C# RandomAccessFileOrArray.Skip方法代碼示例

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


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

示例1: GetNumDirectories

 // Utilities
 
 /**
 * Returns the number of image directories (subimages) stored in a
 * given TIFF file, represented by a <code>SeekableStream</code>.
 */
 public static int GetNumDirectories(RandomAccessFileOrArray stream)
 {
     long pointer = stream.FilePointer; // Save stream pointer
     
     stream.Seek(0L);
     int endian = stream.ReadUnsignedShort();
     if (!IsValidEndianTag(endian)) {
         throw new ArgumentException(MessageLocalization.GetComposedMessage("bad.endianness.tag.not.0x4949.or.0x4d4d"));
     }
     bool isBigEndian = (endian == 0x4d4d);
     int magic = ReadUnsignedShort(stream, isBigEndian);
     if (magic != 42) {
         throw new ArgumentException(MessageLocalization.GetComposedMessage("bad.magic.number.should.be.42"));
     }
     
     stream.Seek(4L);
     long offset = ReadUnsignedInt(stream, isBigEndian);
     
     int numDirectories = 0;
     while (offset != 0L) {
         ++numDirectories;
         
         // EOFException means IFD was probably not properly terminated.
         try {
             stream.Seek(offset);
             int entries = ReadUnsignedShort(stream, isBigEndian);
             stream.Skip(12*entries);
             offset = ReadUnsignedInt(stream, isBigEndian);
         } catch (EndOfStreamException) {
             numDirectories--;
             break;
         }
     }
     
     stream.Seek(pointer); // Reset stream pointer
     return numDirectories;
 }
開發者ID:jagruti23,項目名稱:itextsharp,代碼行數:43,代碼來源:TIFFDirectory.cs

示例2: GetNumDirectories

 // Utilities
 
 /**
 * Returns the number of image directories (subimages) stored in a
 * given TIFF file, represented by a <code>SeekableStream</code>.
 */
 public static int GetNumDirectories(RandomAccessFileOrArray stream)
 {
     long pointer = stream.FilePointer; // Save stream pointer
     
     stream.Seek(0L);
     int endian = stream.ReadUnsignedShort();
     if (!IsValidEndianTag(endian)) {
         throw new ArgumentException("Bad endianness tag (not 0x4949 or 0x4d4d).");
     }
     bool isBigEndian = (endian == 0x4d4d);
     int magic = ReadUnsignedShort(stream, isBigEndian);
     if (magic != 42) {
         throw new
         ArgumentException("Bad magic number, should be 42.");
     }
     
     stream.Seek(4L);
     long offset = ReadUnsignedInt(stream, isBigEndian);
     
     int numDirectories = 0;
     while (offset != 0L) {
         ++numDirectories;
         
         // EOFException means IFD was probably not properly terminated.
         try {
             stream.Seek(offset);
             int entries = ReadUnsignedShort(stream, isBigEndian);
             stream.Skip(12*entries);
             offset = ReadUnsignedInt(stream, isBigEndian);
         } catch (EndOfStreamException) {
             //numDirectories--;
             break;
         }
     }
     
     stream.Seek(pointer); // Reset stream pointer
     return numDirectories;
 }
開發者ID:nicecai,項目名稱:iTextSharp-4.1.6,代碼行數:44,代碼來源:TIFFDirectory.cs

示例3: TIFFDirectory

 /**
 * Constructs a TIFFDirectory from a SeekableStream.
 * The directory parameter specifies which directory to read from
 * the linked list present in the stream; directory 0 is normally
 * read but it is possible to store multiple images in a single
 * TIFF file by maintaing multiple directories.
 *
 * @param stream a SeekableStream to read from.
 * @param directory the index of the directory to read.
 */
 public TIFFDirectory(RandomAccessFileOrArray stream, int directory)
 {
     
     long global_save_offset = stream.FilePointer;
     long ifd_offset;
     
     // Read the TIFF header
     stream.Seek(0L);
     int endian = stream.ReadUnsignedShort();
     if (!IsValidEndianTag(endian)) {
         throw new ArgumentException(MessageLocalization.GetComposedMessage("bad.endianness.tag.not.0x4949.or.0x4d4d"));
     }
     isBigEndian = (endian == 0x4d4d);
     
     int magic = ReadUnsignedShort(stream);
     if (magic != 42) {
         throw new ArgumentException(MessageLocalization.GetComposedMessage("bad.magic.number.should.be.42"));
     }
     
     // Get the initial ifd offset as an unsigned int (using a long)
     ifd_offset = ReadUnsignedInt(stream);
     
     for (int i = 0; i < directory; i++) {
         if (ifd_offset == 0L) {
             throw new ArgumentException(MessageLocalization.GetComposedMessage("directory.number.too.large"));
         }
         
         stream.Seek(ifd_offset);
         int entries = ReadUnsignedShort(stream);
         stream.Skip(12*entries);
         
         ifd_offset = ReadUnsignedInt(stream);
     }
     
     stream.Seek(ifd_offset);
     Initialize(stream);
     stream.Seek(global_save_offset);
 }
開發者ID:jagruti23,項目名稱:itextsharp,代碼行數:48,代碼來源:TIFFDirectory.cs

示例4: TIFFDirectory

 /**
 * Constructs a TIFFDirectory from a SeekableStream.
 * The directory parameter specifies which directory to read from
 * the linked list present in the stream; directory 0 is normally
 * read but it is possible to store multiple images in a single
 * TIFF file by maintaing multiple directories.
 *
 * @param stream a SeekableStream to read from.
 * @param directory the index of the directory to read.
 */
 public TIFFDirectory(RandomAccessFileOrArray stream, int directory)
 {
     
     long global_save_offset = stream.FilePointer;
     long ifd_offset;
     
     // Read the TIFF header
     stream.Seek(0L);
     int endian = stream.ReadUnsignedShort();
     if (!IsValidEndianTag(endian)) {
         throw new
         ArgumentException("Bad endianness tag (not 0x4949 or 0x4d4d).");
     }
     isBigEndian = (endian == 0x4d4d);
     
     int magic = ReadUnsignedShort(stream);
     if (magic != 42) {
         throw new
         ArgumentException("Bad magic number, should be 42.");
     }
     
     // Get the initial ifd offset as an unsigned int (using a long)
     ifd_offset = ReadUnsignedInt(stream);
     
     for (int i = 0; i < directory; i++) {
         if (ifd_offset == 0L) {
             throw new
             ArgumentException("Directory number too large.");
         }
         
         stream.Seek(ifd_offset);
         int entries = ReadUnsignedShort(stream);
         stream.Skip(12*entries);
         
         ifd_offset = ReadUnsignedInt(stream);
     }
     
     stream.Seek(ifd_offset);
     Initialize(stream);
     stream.Seek(global_save_offset);
 }
開發者ID:nicecai,項目名稱:iTextSharp-4.1.6,代碼行數:51,代碼來源:TIFFDirectory.cs


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