Java InputStream reading problem

I have a Java class, where I'm reading data in via an InputStream

    byte[] b = null;
    try {
        b = new byte[in.available()];
        in.read(b);
    } catch (IOException e) {
        e.printStackTrace();
    }

It works perfectly when I run my app from the IDE (Eclipse).

But when I export my project and it's packed in a JAR, the read command doesn't read all the data. How could I fix it?

This problem mostly occurs when the InputStream is a File (~10kb).

Thanks!

8
задан Michael 28 May 2011 в 08:41
поделиться