Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Posts: 35
Registered: ‎04-16-2009
My Device: Not Specified
Accepted Solution

Having read a text file in as a string...

Although there seems to be lots of ways to read in a file in regular Java, the only article using the Blackberry libraries that I have found is referenced a number of times in this Forum:

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800620/How_To_...

 

However, this example only takes the file and then returns the file as one whole stream. 

 

I've got a situation where I have a text file with delimited values that need to be inserted into a Persistent table.  I know how to use split() to break apart the delimiters, but is there a mechanism for reading the line feeds?

 

Right now, here is the format (small sample):

 

Akin, William|001
Burt, Ricky|002
Allen, Debbie|005
Baldwin, Kay|008
Gallant, Jason|011
Bowen, Edward|016

 

How do a set up a loop to go through the lines one at a time (I want to populate an array with the values)?

 

Thanks in advance.

 

-- John  Kiernan

Highlighted
BlackBerry Development Advisor
Posts: 15,506
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Having read a text file in as a string...

You could use the LineReader class to read one line at a time.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 35
Registered: ‎04-16-2009
My Device: Not Specified

Re: Having read a text file in as a string...

Thanks Mark!

 

-- John

New Developer
Posts: 7
Registered: ‎05-20-2009
My Device: Not Specified

Re: Having read and write text file from computer ...

Hi...

          I want to develop an application , in which after connecting the device to computer  . the device should ask for the location of the text file

 (if i gave like this CSmiley Tonguerogramfiles\xyz.txt), it should read that text file if the file was present.. and in  the same way i want to do  write some thing...