Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 6th, 2001, 04:16 AM
otsche otsche is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: Germany
Posts: 0 otsche User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
File processing please help!

Hello,
I know this is not server-side topic, but perhaps someone could help me. I am trying a file-processing with a large file (50 mb).
The File is splitted according to a condition in the if clauses and the different rows should be written to 9 target files. Here's the code:


public void splitData (String source1, String t00, String t10,String t20,String t30,String t40,String t50,String t60,String t70,String t80)
{
String line;
BufferedWriter t0,t1,t2,t3,t4,t5,t6,t7,t8;
BufferedReader s;

try
{
s = new BufferedReader(new FileReader(source1));
t0 = new BufferedWriter(new FileWriter(t00));
t1 = new BufferedWriter(new FileWriter(t10));
t2 = new BufferedWriter(new FileWriter(t20));
t3 = new BufferedWriter(new FileWriter(t30));
t4 = new BufferedWriter(new FileWriter(t40));
t5 = new BufferedWriter(new FileWriter(t50));
t6 = new BufferedWriter(new FileWriter(t60));
t7 = new BufferedWriter(new FileWriter(t70));
t8 = new BufferedWriter(new FileWriter(t80));

System.out.println("Splitting file..."+source1);

int total=0;
// long anfang = System.currentTimeMillis();

while ((line = s.readLine()) != null)
{
if ((line.substring(70,72)).equals("00")) {t0.write(line);t0.newLine();}
if ((line.substring(70,72)).equals("10")) {t1.write(line);t1.newLine();}
if ((line.substring(70,72)).equals("20")) {t2.write(line);t2.newLine();}
if ((line.substring(70,72)).equals("30")) {t3.write(line);t3.newLine();}
if ((line.substring(70,72)).equals("40")) {t4.write(line);t4.newLine();}
if ((line.substring(70,72)).equals("50")) {t5.write(line);t5.newLine();}
if ((line.substring(70,72)).equals("60")) {t6.write(line);t6.newLine();}
if ((line.substring(70,72)).equals("70")) {t7.write(line);t7.newLine();}
if ((line.substring(70,72)).equals("80")) {t8.write(line);t8.newLine();}

total++;

}



The problem is that processing starts but after a while I get:

java.lang.OutOfMemoryError: no stack trace available

I think the problem is the file size, with a small file (21kb), it works fine... but I have to process this big file

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > File processing please help!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway