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
shridatt
Posts: 17
Registered: ‎04-17-2011
My Device: Blackberry Bold 9780

Reading file contents stored on SDcard and store

hello everybody

 

i am working on a backberry application and my application is basically a search type application.

 

i have started of with the simplest way possible. i put many text files (.txt) in diffrent folders in store as well as the SDcard of BB. and then i manually entered some data in the files.

 

my application does a search within the contents of the file. so i gave a word for eg. "hi" as an input and all the files that contain the word "hi" in their contents.

 

now i want to use the same approach of mine for diffrent file types like .doc , .ppt , .docx, .pptx , .pdf (all document types specifically supported by the blackberry) and also for diffrent image types like .png, .jpeg , .gif (all image type supported by blackberry) and finally the mailboxes of the blackberry email client .

 

i have tried to do the same in java and it is possible to do so. and when i did this in java i had to use some specific JAR's for the file types (i have done this only for document types till now).

 

is it possible for me to incorporate this JAR's in my BB app?

 

please help....ITS urgent

 

This is a request to the prodigy PETER STRANGE to look into my matter. i have learnt it all from you sir :smileyhappy:

 

hoping to hear from you soon....

 

 

thank you

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: Reading file contents stored on SDcard and store

[ Edited ]

Oh dear, I am going to come up short here....

 

Sorry I have no idea how one would search file types like doc and ppt for text strings.  I don't even know how I would do it on the PC.  ANd ask for searching image files, well that is beyond me.

 

But it appears you have jars that will do this for you.  Again I'm going to come up short.  I think I know how to do this in JDE, but I'll bet you are using Eclipse. 

 

But a word of caution.  In order for these jars to be useful on the BlackBerry, they can not use any Java that the BlackBerry does not support.  This basically means they have to be compiled using Java 1.4, which is pretty old.  And they can't use any facilities that the BlackBerry Java VM does not support.  So I would be suspicious that the jars you have will not even work on the BlackBerry, even after you have converted these to a cod file for loading. 

 

Do you have access to the source for these jars?

Developer
mtatro
Posts: 105
Registered: ‎06-23-2010
My Device: 9000

Re: Reading file contents stored on SDcard and store

My thoughts on this:

 

I have done something similar on a server environment and it is not easy. Regarding the amount of file types you may need to support, never mind the versions (the MS stuff changed quite dramatically from 2003 to 2010), I simply cannot see a BB doing this well. 

 

Better approach would be a server side implementation.

 

-matt

Press Kudos if this helped - ;-)
New Developer
shridatt
Posts: 17
Registered: ‎04-17-2011
My Device: Blackberry Bold 9780

Re: Reading file contents stored on SDcard and store @peter Strange

[ Edited ]

Sir,

 

i have acces to the class files, but i dont have any .java file as such from that jar. i tried decompiling it but hard luck.

 

the jar name is poi.jar version 3.7 and this is specifically for microsoft document types.i have attached it here. As tried in J2SE it works perfect, but J2ME i hardly have any idea. There is an alternate way to do this fuctionality even i.e. by reading bytes from the file.i saw in forums here, there is a program which reads through the contents of the Email and also the attachments for the Email. The reading is done in Byte format. Can this approach help in case of diffrent Document type? As this bytes are returning Hexadecimal values those can be converted to string. But even there are some garbage values added in such a conversion.

 

and about the image types i would like to approach is an cross application approach. can i integrate an OCR application into my app?.

 

 

New Developer
shridatt
Posts: 17
Registered: ‎04-17-2011
My Device: Blackberry Bold 9780

Re: Reading file contents stored on SDcard and store @mtatro

sir,

 

 i didnot get your perspective on this. how it will be possible to remotely perform the search ? can you be more specific?

 

i think this would be a good idea,but this will be just a connection as per i understand and not an app?

 

thank you

 

 

 

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: Reading file contents stored on SDcard and store @peter Strange

[ Edited ]

Sorry, you will not be able to use poi.jar on a BlackBerry, or in fact on any J2ME device. 

 

You can of course read the individual bytes in the files, and, if you understand the file format, interpret them and decide if they are text or not.  But you will have to understand the file formats. 

 

Re OCR, if you can find a J2ME OCR package, then you can sue this to convert an image into text.  I am not aware of one.

 

But if your documents were based on a Server, then you can run poi.jar on the Server and return the results to the BlackBerry.  For me, this is the simplest solution. 

New Developer
shridatt
Posts: 17
Registered: ‎04-17-2011
My Device: Blackberry Bold 9780

Re: Reading file contents stored on SDcard and store

Okay so the code signing of the jars wont help sir?
Hmmm.... Okay i have seen nokia java ocr applications which convert captured images into a text file.so these packages used in the applications are j2me supported...but a problem i might face is that these applications are legacy apps.
And one more thing i would like to add up is can a server do this scan in a connection itself?
In such sort of scenario that i am thinking is that server is reading the devices memory and picking up all th contents from it.
New Developer
shridatt
Posts: 17
Registered: ‎04-17-2011
My Device: Blackberry Bold 9780

Re: Reading file contents stored on SDcard and store

But i have a doubt in my mind that how can server do this effectively for many blackberry devices!
There will be problems regarding efficiency and scalability of the processing...the multithreaded architecture if implemented will totally depend on the amount of files each device is having.

And a question of mine which you haven't answered sir is that does the blackberry device only uses the default email client or there are other legacy applications too?
I need to know this as i want to read email boxes
New Developer
shridatt
Posts: 17
Registered: ‎04-17-2011
My Device: Blackberry Bold 9780

Re: Reading file contents stored on SDcard and store

Sir before you leave this place please give me your contact... PM me..please..it will be a pleasure to learn something from you..:-)

And i mention it here now thank you for all your posts.

I am using this forums using phone so posting becomes short.

Anyways...waiting to hear from you soon.
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: Reading file contents stored on SDcard and store

"so the code signing of the jars wont help"

Correct, it will not help. 

 

"i have seen nokia java ocr applications"

I can't find anything. 

 

"And one more thing i would like to add up is can a server do this scan in a connection itself?
In such sort of scenario that i am thinking is that server is reading the devices memory and picking up all th contents from it."

No, the Server would need 'local' (to the server) access to the file(s) to be searched. 

 

"how can server do this effectively for many blackberry devices"

Good question - there is a challenge.

 

"does the blackberry device only uses the default email client or there are other legacy applications too?"

Don't know what you mean here.  Other text based data that you might want to search includes other PIM data (e.g. Calendar, Memo and/or Tasks).  Note also that a BlackBerry can support a number of email addresses too. 

 

"... please give me your contact."

Sorry, not something I do.  If you need me, you can PM me.  But I only answer questions on the forum.