473,382 Members | 1,611 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,382 software developers and data experts.

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 2420
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.pipex.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
'CharArrayReader' / 'CharArrayWriter', 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.substring
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.pipex.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.substring 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
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. ...
9
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,...
8
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...
7
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...
1
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...
3
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
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...
0
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....
36
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.