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

Re: Reading file contents stored on SDcard and store

Sir,

 

getting back to you, i take back my words about not finding the source codes for the JAR.

 i have managed to get  the source of the jar.

 

its huge in size around 38 MB so i dont know actually whether i can attach it here.

but i will paste the link here.

POI jar

 

 

apache site has all the documents for the same

 

 

this supports all microsoft document types. now is it possible to include it into the JDE and make the application work?

 

also the source for accessing pdf files i have lined here pdfbox.

 

advice me on what we can do out of the source.

 

thank you.

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

Re: Reading file contents stored on SDcard and store

It is not possible to use this source directly in a J2ME device because parts of this are based on J2SE classes that do not exist in J2ME phones.

 

For example CloseIgnoringInputStream, extends java.io.FilterInputStream which is not a J2ME supported class. 

 

I suspect that to use this source, you will have to go through it and replace or remove code that references unsupported classes.  I suspect once you have done that,, you will have to re-implement functions using J2ME/BlackBerry supported APIs, for example, you will probably have to change all the I/O to use the FileConnection API.  I suspect this is months of work, though clearly not impossible.  And it would be an interesting exercise. 

 

Similarly pdfbox uses non J2ME classes, such as the awt package. 

 

So unless you are prepared to sit down for a long re-write I do not think this source is useful to you in your project. 

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

Re: Reading file contents stored on SDcard and store

Hello sir,

 

back after a long time.

so i have found a way, it seems that every file type that exists can be opened and the content of it can be browsed but the content is in form of bytes.

 

but in this approach what happens is there are a lot of junk characters coming in place and this  are the ones representing the blank spaces and other special characters.

 

so then i thot of using some encoding techniques on this bytes which i obtained. tried doing Base64 encding and decoding both. but the decoding doesnot work. this is merely going to solve the problem.

 

is there any suggession from your side about the encoding technique to be used? please help me on this

 

thank you

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

Re: Reading file contents stored on SDcard and store

These bytes are unlikely to be a result of the encoding used.  Most likely they are instructions that the normal "reader" knows about and interprets and uses to format the document.   The Java packages from Apache that you tried to use are all smart enough to interpret these correctly and ignore the formatting instructions and so are able to distinguish the text from this.  If you look very hard as the source you might be able to figure out how to do this.  Also in most cases, you will find documentation for the specific format, so you could write something yourself.  But be warned, this is not easy. 

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

Re: Reading file contents stored on SDcard and store

so this encryption that is done on the actual data if understood than probably there is a way out to go through the actual text/data by decoding ths encryption. hmmm okay. ill spend some time on this and get back to you.

 

mean while ill update my other posts too.

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

Re: Reading file contents stored on SDcard and store

This is not encryption or encoding.  It is formatting. 

 

Here is a good example.  You are viewing this page on a Browser.  Your Browser will have an options to View the actual source, i.e. the actual bytes that are sent to the Browser that the Browser formats.  I'm using IE, so I look at the View menu item along the top and when I click that, I can select Source.  Please do that.  And look at the actual bytes that are sent to the Browser.  This is clearly nothing like what you see.  because the Browser knows how to use these bytes, as formatting instructions (like font, and font sizes) and knows how to extract the text to be displayed.

 

All the files that you what to read are similar.  They all have their own formatting.  Unless you understand this formatting you will not be able to separate the text from the formatting. 

 

Encryption and encoding are completely different things.