473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

What class to use for big strings ?

Hello,

My program is creating pdf files, around 50 - 100 kB each. Today I write
them in text files, then read them back to store into a database. It's
obvious for me that I can save the text file operations by creating a big
string in memory (only append), but it's unclear what class to use : String
StringBuilder, Stream something or ?

My pdf files contain mainly text, but some of them could also contain a jpeg
image.

Thank you for your help,
Gilbert
Oct 20 '08 #1
4 1814
On Oct 20, 9:17*am, "Gilbert Tordeur" <gilbert.tord...@orange.fr>
wrote:
Hello,

My program is creating pdf files, around 50 - 100 kB each. Today I write
them in text files, then read them back to store into a database. It's
obvious for me that I can save the text file operations by creating a big
string in memory (only append), but it's unclear what class to use : String
StringBuilder, Stream something or ?

My pdf files contain mainly text, but some of them could also contain a jpeg
image.
The typical (as far as I am aware) way of storing binary data into a
database is to use a binary reader and a memory stream.
Oct 20 '08 #2
If you just need to "store" the string, then String is fine, but if you will
be doing manipulation of the string, then use StringBuilder.

If you want to compact the data, you could write the data out using a
BinaryWriter.

"Gilbert Tordeur" <gi*************@orange.frwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Hello,

My program is creating pdf files, around 50 - 100 kB each. Today I write
them in text files, then read them back to store into a database. It's
obvious for me that I can save the text file operations by creating a big
string in memory (only append), but it's unclear what class to use :
String StringBuilder, Stream something or ?

My pdf files contain mainly text, but some of them could also contain a
jpeg image.

Thank you for your help,
Gilbert

Oct 20 '08 #3
Gilbert,

As it are real big strings, then zip them first (there is more than one
method in Net for that) and put the Zip object as a blob (byte array or the
other name is image) in your database.

http://msdn.microsoft.com/en-us/libr...zipstream.aspx

http://www.vb-tips.com/DataSetImage.aspx

Cor

"Gilbert Tordeur" <gi*************@orange.frwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Hello,

My program is creating pdf files, around 50 - 100 kB each. Today I write
them in text files, then read them back to store into a database. It's
obvious for me that I can save the text file operations by creating a big
string in memory (only append), but it's unclear what class to use :
String StringBuilder, Stream something or ?

My pdf files contain mainly text, but some of them could also contain a
jpeg image.

Thank you for your help,
Gilbert
Oct 20 '08 #4
Cor, Scott,

May thanks for your advices.

Have a good week-end,
Gilbert
Oct 31 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: David Mertz | last post by:
At the suggestion of one of my correspondents, I slightly reluctantly implemented an RSS feed for my website/writing. It is perhaps a bit crude so far, but maybe I'll spiff it up. The RSS also...
220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
3
by: Chris Cioffi | last post by:
I started writing this list because I wanted to have definite points to base a comparison on and as the starting point of writing something myself. After looking around, I think it would be a...
24
by: Xah Lee | last post by:
in computer languages, often a function definition looks like this: subroutine f (x1, x2, ...) { variables ... do this or that } in advanced languages such as LISP family, it is not uncommon...
2
by: Pierre Rouleau | last post by:
Greetings, I'm wondering why the >> operator does not use the write() method of a class derived from the built-in file class as in DerivedFile below. In the following example: - StringFile...
3
by: emerth | last post by:
Suppose I have these 4 typedefs, where each of the 2nd parameter in each is a simple class that just contains a different number of strings: typedef map < char*, cctrlrec_data, ltstr >...
17
by: Xah Lee | last post by:
What are OOP's Jargons and Complexities Xah Lee, 20050128 The Rise of Classes, Methods, Objects In computer languages, often a function definition looks like this: subroutine f (x1, x2, ...)...
1
by: Scott Smith | last post by:
Several attributes and interface methods I'm using refer to resources (such as strings or icons) by a numeric ID. This was the only way to refer to resources in unmanaged code (C++, for example),...
18
by: Jm | last post by:
Hi all I feel stupid for asking this, but i just went to use the left() function from vb6 only to find it doesnt do what it used to under .NET. Im assuming theres something else now im meant to...
18
by: Xah Lee | last post by:
What are OOP's Jargons and Complexities Xah Lee, 20050128 Classes, Methods, Objects In computer languages, often a function definition looks like this: subroutine f (x1, x2, ...) {...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.