Dear Jeff, Thanks a lot for your reply. Sorry that I didn't check the message in time. I managed to use Skip and GetStream()->seekg to move the cursor as I need. I'm happy to see that my code works as expected now.
So problem is solved. Have nice weekend. Best regards Jing On Sunday, August 3, 2014 9:36:55 PM UTC+2, Jeffrey Walton wrote: > > > > On Thursday, July 31, 2014 4:57:28 AM UTC-4, Jing Bai wrote: >> >> ... >> >> So I wonder what is the right way to do it. Can I tell cryptoPP to jump >> over the big data segment without loading it? >> > I think you can use Skip() to skip the bytes you are not interested in. > I'm not sure if it jumps over a chunk of bytes intelligently. > > For the FileSource, make sure pumpAll is false [1]. Then, throttle it into > your parser or skip it as desired. > > >> Can I use StringSource with dynamic content and control the "cursor" >> inside CryptoPP? >> > Perhaps, but we'd need to see more details. > > >> Any advice/hint is appreciated. If you have some code segment I can refer >> to that would be great. >> > With large files, you usually use the OS to map a view of the file into > memory. On Windows, that's MapViewOfFile [2] and on Linux that's mmap [3]. > > As the memory is mapped in, wrap it in a StringSource. then use the > StringSource's to TransferTo() to move it to the BufferedTransformation > that's parsing things. > > Jeff > > [1] http://www.cryptopp.com/docs/ref/class_file_source.html > [2] > http://msdn.microsoft.com/en-us/library/windows/desktop/aa366761%28v=vs.85%29.aspx > [3] http://linux.die.net/man/2/mmap > -- -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com. --- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
