Apologies if this has been sorted, I'm not actually on the POI mailing
list - just getting into it.

It seems to me that the org.apache.poi.util.LittleEndian class doesn't cater
the for situation for ClassID as it returns numbers and not byte[] - so if
you use it's methods you still have to convert to a byte[] after.

I think the following version of ClassID should work:

==========> ClassID STARTS HERE
<=================================================================
package org.apache.poi.hpsf;

public class ClassID {

    private byte[] bytes;

    public ClassID(final byte[] src, final int offset) {
       bytes = read(src, offset);
    }

    public final static int LENGTH = 16;

    public int length() {
        return LENGTH;
    }

    public byte[] getBytes() {
        return bytes;
    }

    public byte[] read(byte[] src, int offset) {

        byte[] dest = Util.copy(src, offset, 24);

        int destOffset = 0;
        int srcOffset = 0;
        Util.copy(readField(src, offset, 8), 0, 8, dest, destOffset);
        Util.copy(readField(src, offset += 8, 4), 0, 4, dest, destOffset +=
8);
        Util.copy(readField(src, offset += 4, 4), 0, 4, dest, destOffset +=
4);

        return dest;

    }

    public static byte[] readField(byte[] src, int offset, int lth) {

        byte[] dest = new byte[lth];
        for (int i = 0; i < lth; i++) {
            dest[i] = src[offset + lth - 1 - i];
        }
        return dest;

    }

}
==========> ClassID ENDS HERE
<=================================================================

Niall

> -1 - a more reasonable alternative: quit sulking and help me understand
>
http://jakarta.apache.org/poi/javadocs/javasrc/org/apache/poi/hpsf/ClassID_j
ava.html#ClassID
> (scroll to the method clearly marked REWRITE ME REWRITE ME)
>
> Read this method before you vote!  and if someone other than rainer (who
donen't have time)
> wants to give me a hand in figuring that method out, that would be
appreciated and
> probably
> make this whole argument moot!
>
> Buenos Dias,
>
> Andy


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to