poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Sheil <den...@vartmp.com>
Subject Re: POI HSSF now ported to Android - XSSF on the other hand...
Date Wed, 02 Nov 2011 09:46:45 GMT
On Mon, Oct 31, 2011 at 3:24 AM, Yegor Kozlov <yegor.kozlov@dinom.ru> wrote:
> Would you like to put a reference to your project on the POI web
> site? We can create  a "Related Project" section and put a reference
> to android-spreadsheet there along with a short description. Questions
> about POI on Android become common on the POI mailing lists and a link
> on the POI web site may draw new contributors to your project. If you
> are interested, we can work on that .

Oh sure, that would be great.  As I said, HSSF works.  And XSSF can be
attacked from two angles.  One would be from the angle of POI
expertise, which would mostly consist of whittling down the schemas
file (or anything else than can be whittled down) until it, and every
other jar and class included consisted of less than 65336 methods.
It's probably the easier way, if doable.  The other method of attack
would be the angle from those with more Android expertise, which would
consist of loading more than one of these 65536 method-limited Dalvik
executable files into one Android project.  It would consist in
creating interfaces between the main classes and the schema classes,
explicitly loading each needed class from the schema, and other
painful stuff.

A few weeks back, I made an attempt at what you suggested.  I went
into the src/ooxml/testcases/org/apache/poi directory and began
commenting out sections of the five test java files there.  I
commented out imports such as say
org.apache.poi.xwpf.usermodel.XWPFDocument, made methods such as
testPowerPoint() empty, and erased all files in directories such as
xwpf and xslf altogether.

I whittled it from a 4186013 byte sized compiled jar with 1513 classes
to a 3301438 byte sized compiled jar with 955 classes running only 596
tests.  It is possible I could do more whittling, I got most of the
low-hanging fruit.

Counting classes, not methods, I saw that for each jar, the number of
classes was:

poi-ooxml-schemas.jar 955 classes
poi 1182 classes
poi-ooxml 256 classes
xmlbeans 1503 classes
dom4j 190 classes

Which adds up to 4086 classes.  So an average of 17 methods per class
would put it over the method limit - and these are not the only
methods that will go into the Dalvik executable, there are the Android
methods to think of as well.

The Dalvik executable will compile even if it is missing needed
library calls - it will not compile with more than 65536 methods.  If
I pull out poi-ooxml-schemas.jar it will compile.  If I pull out
xmlbeans it will compile.  It will not compile with both in at the
same time, where schemas still has 955 classes.

My next step I guess is to get an accurate count of exactly how many
methods are in these five jars, as well as seeing how many
Android-specific methods there are.  Then I will try to whittle down
the schemas file more - there may be a few tests I did not get yet,
although the ones in the xwpf and xslf  directories are cleared out.

As I got schemas from 1513 to 955 classes, I have thought of maybe
trying to pull some classes out of xmlbeans as well, as xmlbeans still
has 1503 classes.  I will see how that goes.

Although this e-mail goes into it somewhat, I will be doing more work
on this this week and next week, and by the end of next week I'll open
a bug on this issue on github (
https://github.com/dennis-sheil/android-spreadsheet/issues ) with the
details, many of which are in this e-mail.

It might not be an easy problem!  But there two angles of attack - try
to whittle down the methods to less than 65536, and if that can't be
done, go through the arduous process of loading classes individually,
creating interfaces for them and so forth.  Anyhow, HSSF is on Android
now, and with some amount of effort XSSF can be on Android as well.


To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message