I've finally found the problem:

    /**
     * Returns 0 when when this stream has exhausted its input; and 1
otherwise.
     * A result of 1 does not guarantee that further bytes can be
returned,
     * with or without blocking.
     *
     * <p>Although consistent with the RI, this behavior is
inconsistent with
     * {...@link InputStream#available()}, and violates the <a
     * href="http://en.wikipedia.org/wiki/
Liskov_substitution_principle">Liskov
     * Substitution Principle</a>. This method should not be used.
     *
     * @return 0 if no further bytes are available. Otherwise returns
1,
     *         which suggests (but does not guarantee) that additional
bytes are
     *         available.
     * @throws IOException if this stream is closed or an error occurs
     */
    @Override
    public int available() throws IOException {
        if (closed) {
            // archive.1E=Stream is closed
            throw new IOException(Messages.getString("archive.1E")); //
$NON-NLS-1$
        }
        if (eof) {
            return 0;
        }
        return 1;
    }

Google YMMD! (The "official" oracle javadoc isn't that clear about the
violation)

So what was happening? The kXML happily checked for available bytes,
always received 1 and happily got stuck reading the input. I've now
wrapped the available method like this

    @Override
    public int available() throws IOException {
        if (inf.needsInput()) {
            return 0;
        }
        return super.available();
    }

and everything is working as expected....

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to