473,586 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help, processing strings >32K

D
Hi folks,
This may be pretty simple for you guys but it has me stumped.

BTW I'm using Java 1.1, I know it's old, don't ask me why, I just have to.

I have a long string in excess of 50k that I need to process in 32k chunks.
The problem is all string processing in Java is done with integers. Is
there an easy way to stream multiple 32k chunks of information from a
string/array into a holding string/array?

Thanks

Dave
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.542 / Virus Database: 336 - Release Date: 18/11/2003
Jul 17 '05 #1
4 2437
D wrote:
Hi folks,
This may be pretty simple for you guys but it has me stumped.

BTW I'm using Java 1.1, I know it's old, don't ask me why, I just have to.

I have a long string in excess of 50k that I need to process in 32k chunks.
The problem is all string processing in Java is done with integers. Is
there an easy way to stream multiple 32k chunks of information from a
string/array into a holding string/array?


Java int variables are 32 bit, so they can hold numbers much larger than
32k. As string objects have a length, you can store any character in
them, unlike in C. There might be a restriction on String constants,
though I can't think of one right now.

What is it that you can't get it to do?

-- glen

Jul 17 '05 #2

"D" <no***@nowhere. COM> wrote in message
news:3f******** *************** @news.dial.pipe x.com...
Hi folks,
This may be pretty simple for you guys but it has me
stumped.

BTW I'm using Java 1.1, I know it's old, don't ask me
why, I just have to.

Fair enough, all problems must be solved given constraints [specified, or
impleid], so I guess the challenge is to find the 'best' [very relative !]
solution within the given constraints.

I have a long string in excess of 50k that I need to process in
32k chunks. The problem is all string processing in Java is
done with integers. Is there an easy way to stream multiple
32k chunks of information from a string/array into a holding
string/array?


Have you looked at using 'StringReader' / 'StringWriter', and
'CharArrayReade r' / 'CharArrayWrite r', all available in 1.1 ?

I hope this helps.

Anthony Borla
Jul 17 '05 #3
D
Hi Glen, Anthony.
I'm currently looking at streams to solve this problem, probably the main
issue is that I don't come from an OO background.
Anyway the problem I have is this:
I have a large string (say 100000 bytes) passed into my routine. I need to
read this entire string in blocks of 32000 bytes as these will be passed to
another routine for further processing.
Now with my limited Java experience my thinking was to use String.substrin g
to chop out the necessary sections of data but of course you can't specify a
starting position greater than the size of an integer so I'm looking at
streams and readers now but I don't know any techniques for doing what I
need.

So what I need is some way of streaming in 32000 bytes of the string to
another array or string and repeat until the end of the string is reached.

Many thanks

Dave
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.542 / Virus Database: 336 - Release Date: 18/11/2003
Jul 17 '05 #4

"D" <no***@nowhere. COM> wrote in message
news:3f******** *************** @news.dial.pipe x.com...
Hi Glen, Anthony.
I'm currently looking at streams to solve this problem, probably the main
issue is that I don't come from an OO background.
Anyway the problem I have is this:
I have a large string (say 100000 bytes) passed into my routine. I need to read this entire string in blocks of 32000 bytes as these will be passed to another routine for further processing.
Now with my limited Java experience my thinking was to use String.substrin g to chop out the necessary sections of data but of course you can't specify a starting position greater than the size of an integer so I'm looking at
streams and readers now but I don't know any techniques for doing what I
need.

So what I need is some way of streaming in 32000 bytes of the string to
another array or string and repeat until the end of the string is reached.

Many thanks

Dave
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.542 / Virus Database: 336 - Release Date: 18/11/2003


You still seem to have missed that Java integers are 32 bit so string
lengths up to about 2000000000 characters are never a problem. Substring
will work fine, although using strings for such long sequences of characters
seems very inefficient.

Silvio Bierman
Jul 17 '05 #5

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

Similar topics

9
2257
by: Christian Wetzig | last post by:
hi, i have a table with test_field of type "TEXT". when i do: select test_field from test where id=1; the connection (with psql) hangs and no output is received, so i have to kill psql. this occurs, at first sight, if length(test_field)>32748.
9
2302
by: terry | last post by:
I am a programmer (cobol, peoplesoft, sqr, etc.) so I am familiar with programming logic, etc. but not very familiar with C. I need a C program in a study I'm doing. The program is fairly simple, but not familiar with C code it would take me some time to get it to work. A good C programmer can probably give me the code in a few minutes. ...
8
4023
by: Kruton | last post by:
What is the easiest way to take a string from a console while including whitespaces? This program's user will input a line of text that will consist of multiple tokens, but the number tokens and the length of each line will vary at each use. Is there a way to get scanf to take a string that contains whitespace? Or is there another function...
7
6886
by: Andrew | last post by:
VB .NET 2003, WinXP Pro: Adding text to a text box with the TextBox.AppendText method limits the amount of text in the textbox to 32K. I have a short program that uses the GetFiles function of the directory object, then iterates through the returned array and appends the strings to the textbox. However, if the character count is greater...
1
1097
by: shawn_vandenberg | last post by:
hi there i have the following bit of code that downloads/uploads documents from a sql database. the problem i have is when i download an image for example and look at it in notepad i see the binary data and below it the html from the page the image was downloaded from. so my 10k image is now 32k. please any help would be much...
3
2191
by: chrisg | last post by:
Hi All, I've been struggeling with this for a while now, and I was wondering if anyone could help me. given: drop table GENCMP.SCRIPTS; --==============================================================
28
1789
by: jacob navia | last post by:
OK I am running vista. My old machine died with a disk controller failure and I had to buy a new one. The new one was cheaper than the old one (1100 Euros vs 620 Euros) but had twice as much RAM (2GB), twice as much disk space (500GB) and twice as much processor (dual core AMD 64 bits) Within the Vista OS, I installed a Virtual PC with...
0
1803
by: pthai | last post by:
Discover worksheet only retrieved up to 32K characters for my discover worksheet that it pulls data from a clob data column value. I am new to discover plus. Any help would be appreciate. Thanks. pthai
36
1585
by: kwitters | last post by:
I don't know if this is the right place to discuss the death of <in Python 3.0, or if there have been any meaningful discussions posted before (hard to search google with '<>' keyword), but why would anyone prefer the comparison operator != over <>??? I've written an article about it to try and save this nice "is not equal" operator,...
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7841
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7965
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5712
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3838
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1184
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.