BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-10-2008, 03:30 PM   #1 (permalink)
New Member
 
Join Date: Apr 2008
Model: 8830
PIN: N/A
Carrier: verizon
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default text file question

Please Login to Remove!

I need to write to a text file in a way that won't overwrite whatever is in there already. Is this possible?

Is the only option to read the whole file into a string, add stuff to the end, and then write the whole thing to the file again?
Offline  
Old 08-10-2008, 04:08 PM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

Check out the API documentation for the interface FileConnection, in particular the methods: fileSize() and openOutputStream(long byteOffset).
Offline  
Old 08-10-2008, 04:22 PM   #3 (permalink)
New Member
 
Join Date: Apr 2008
Model: 8830
PIN: N/A
Carrier: verizon
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

sorry hrbuckley, I seem to be an idiot today.

I've been working on this thing for the entier weekend (relearning java as I go) and I'm very close to having it fully functional. I'm afraid that I didn't even notice that you could offset the point at which the writer starts writing even though I must have read and stared at the documentation for more then 2 total hours today.

Thanks again man, that should get me to where I want to go.
Offline  
Old 08-10-2008, 06:01 PM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

No problem. The javadocs are OK once you find your way around but they can be mind numbing. I've missed stuff like that too.
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.